Forums

Fields modified w/ js not repopulated if invalid captcha

moleculezz 05 May, 2010
Hello,

I have been messing around with some fields to make them dynamic with Javascript(Mootools). But a problem that I have now is that if the user enters an invalid captcha or leaves it blank, the fields are not getting repopulated. What can be the reason for this or what can I do to fix this?

populates select field options:

myOptions(7, 23, 'uur');
$('vertrektijd_uur').setHTML(options_uur);
			
myOptions(0, 55, 'min');
$('vertrektijd_min').setHTML(options_min);
GreyHead 05 May, 2010
Hi moleculezz,

I'm sorry I have no idea what that script is supposed to be doing. It looks like an incomplete snippet. ChronoForms could probably reload the calues into hidden inputs for you. You script could then apply them to the modified fields.

Bob
moleculezz 05 May, 2010
Didn't think it was that important. It does a loop with the values entered and outputs a list of options inside a select field:
<option value="7">7</option>
<option value="8">8</option>


How would I load the selected option and reload it back when the page refreshes? Normally this is done automatically by chronoforms, but for some reason it does not do it when I do something to the form field with javascript (mootools).
GreyHead 05 May, 2010
Hi moleculezz,

ChronoForms uses a script to read the Form HTML and republish the field values when the page loads. Your select options probably aren't there then so ChronoForms can't set the values, you need to find another way. Either you code the value set yourself, or you find a way to to create the options before the ChronoForms script runs.

Bob
moleculezz 06 May, 2010
Hello Bob,

I'm confused. I'm not sure how to go about doing what you are suggesting. Can you give me more details?
GreyHead 06 May, 2010
Hi moleculezz,

I'm afraid that I don't know either. Very hard to make any suggestions from the info here other than the one I've already given. Write the values back into hidden inputs and then use your scripts to set the selected values.

Bob
moleculezz 06 May, 2010
I was able to get it working by leaving all the options in by default. And then modify the options with MooTools. This allowed it to have the option on page refresh available to select it.
This topic is locked and no more replies can be posted.