Forums

Help with Disappearing Data

Griff1324 19 Feb, 2010
Within Joomla, I am using Chronoforms for my contact us page. I am using the ReCaptcha plugin within my Chronoforms form. If I fill out the form, enter the ReCaptcha incorrectly and hit the submit button, I am then taken back to the contact us page and all of the data that I entered into the form is gone.

This is extremely confusing for the user because it appears that the email was sent properly as they were not given any type of error message. Therefore, is it possible to display an error stating that the ReCaptcha validation failed so that the user knows that they need to resubmit the form? Also, I would like to have the users data remain intact within the form if the ReCaptcha fails so that they do not need to fill out the form again. I do have the "Republish fields if error occured" enabled on the general tab but it does nothing for me.

Any and all help is greatly appreciated.
GreyHead 19 Feb, 2010
Hi Griff1234,

Please post a link to the form. The most likely answer is that a JavaScript conflict is preventing ChronoForms from re-loading the data correctly.

Bob
Griff1324 19 Feb, 2010
The form can be found here:

http://www.customcrateengines.com/contact-us

I do have this piece of javascript in the form html

<script type="text/javascript" defer="defer" src="components/com_chronocontact/js/usableforms.js"></script>


I am not sure if this is causing the problems or not. I need to call the .js file because depending on the subject of the email that the user selects determines if the form shows or hides particular fields.

I was playing around and I discovered the following.

TEST 1

On the general tab in chronoforms if I have the Check Token turned on and Try to Republish enabled the following happens:

When logged into the site as a registered user, if I go to the Contact Us page, fill out the form and type the ReCaptcha wrong then it refreshes the page stating that I entered the recaptcha incorrectly and keeps all of my data filled into the form.

If I log out of the site and go to the Contact Us page as a guest, fill out the form, and type the ReCaptcah wrong or right, then I am presented with a message that I am not allowed to access the URL.

If I log into the backend as the Admin and clean the cache then attempt to fillout the contact us form as a guest with the wrong captcha then the page refeshes and I get no warning message that the recaptcha was incorrect and my form doesn't contain any information that I entered.

TEST 2

On the general tab in chronoforms if I have the Check Token turned off and Try to Republish enabled the following happens (I have also cleared the joomla cache to remove anything from TEST 1):

At first I go to the site as a guest then go to the Contact Us page, fill out the form and type the ReCaptcha wrong then the page refeshes and I get no warning message that the recaptcha was incorrect and my form doesn't contain any information that I entered.

I then log into the site as a registered user, go to the contact us page, fill out the form and enter the recpatcha wrong and hit submit. I then get the recaptcha was entered incorrectly error and my form still contains the data I entered.

I then log out of the site and go back to the contact us page as a guest. Fill out the form, enter the recaptcha wrong and hit submit. This time I get the recpatcha warning and my form is still filled it?!?!

It appears that having a registered user enter the recaptcha wrong triggers something and they it works for everyone. I went back and rand tests 1 and 2 over and over again and the results are always the same.
GreyHead 19 Feb, 2010
Hi Griff1234,

If you view the form without the template and submit it with a wrong ReCaptcha code then the data is re-displayed. So ChronoForms is working OK and there is a JavaScript problem.

FireBug shows an error " var name = "cfvalidate_"+field.getProperty('name').replace('[]', ''); " which suggests that there is field being validated with no name attribute (or a name with a space possibly). I didn't spot any fields like this though :-(

You do though have more than one script on the page . . . see the image below for the list that I found. Given that it's hardly surprising that there are some JavaScript problems :-(

Bob
Griff1324 19 Feb, 2010
OK,

Within Chronoforms I removed the following from my Form HTML

<script type="text/javascript" defer="defer" src="components/com_chronocontact/js/usableforms.js"></script>


This didn't help to resolve the problem.

I then tried to remove the google maps which is called via a module {mosmap} in the Form HTML. This did help to resolve the problem either.

There are times when I visit the Contact Us page using IE that the page doesn't load correctly and there is a yellow yield sign in the bottom left corner of IE for a javascript error. The error is:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Fri, 19 Feb 2010 18:00:28 UTC


Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://www.customcrateengines.com/contact-us




I don't know much about javascript but all of the other scripts should be part of the template and/or modules that I installed into Joomla.

I am just confussed by the fact that it doesn't immediatly work for a guest. However, if a registered user logs in and fills out the contact us form with the wrong recaptcha they get an error as they should. And, as soon as a registered user does this it immediately begins to work properly if a guest enters the wrong recaptcha.
GreyHead 19 Feb, 2010
Hi Griff1234,

I think that the IE error is an occasional problem with ReCaptcha - it seems to depend on how long their server takes to respond. Switching to the ChronoForms anti-spam would stop this.

Bob
Griff1324 19 Feb, 2010
Bob,

Thanks for the help so far. I switched to the chronoforms anti-spam and I am still having the same problem. If a user does not enter the captcha information correctly then the contact us page simply reloads, wipes the form clean, and gives no indication that the captcha was entered incorrectly.

All the built-in Joomla captchas seem to work just fine on my member registration page, guests leaving comments, etc. This problem seems to be isolated to the contact us page and/or chronoforms.

Any other ideas?
GreyHead 19 Feb, 2010
Hi Griff1324,

As I said earlier the reload works Ok if you view the for without the template go I'm reasonably sure that it's a JavaScript conflict. Not much more that I can say or do. You debug as you started out, turn things off one a time looking at the results with FireBug until you pin down the cause.

Bob
Griff1324 20 Feb, 2010
Unfortunatly, I am not that knowledeable with javascript so I don't even know where to begin to start troubleshooting. I appreciate the help.
This topic is locked and no more replies can be posted.