Let's say I have a form like
<p>
<label>
<input type="radio" name="fm" value="1" id="radiooo_0" />
1</label>
<br />
<label>
<input type="radio" name="fm" value="2" id="radiooo_1" />
2</label>
<br />
<label>
<input type="radio" name="fm" value="3" id="radiooo_2" />
3</label>
<br />
</p>
Then I have a built in javascript radio/checkbox to check the field 'fm'
When I click submit, the script returns 'please select one of the above options' on all 3 buttons, not just for the whole group.
I really have no idea what is wrong. Please advice.
I'm not clear if you are using ChronoForms validation for this. If you are then you need 'validate one required' with a div around the group of fields.
Bob
Yes, I'm trying to use ChronoForms validation for the radio buttons.
By using <div> Do you mean something like this?
<div>
<input type="radio" name="fm" value="1" id="radiooo_0" /> 1 <br />
<input type="radio" name="fm" value="2" id="radiooo_1" /> 2 <br />
<input type="radio" name="fm" value="3" id="radiooo_2" /> 3 <br />
</div>
Or do I have to put in the name="fm" inside the div?
Andrew Tetlaw - who wrote the code that ChronoForms uses has this note on the script page:
*To use the validate-one-required validator you must first add the class name to only one checkbox/radio button in the group (last one is probably best) and then place all the input elements within a parent element, for example a div element. That way the library can find all the checkboxes/radio buttons to check and place the validation advice element at the bottom of the parent element to make it appear after the group of checkboxes/radio buttons.
I'm not sure if ChronoForms does this automatically but you can fix it by putting the class="validate_one_required" in your form html; set Validation to ON in he CF tab but *do not* put anything in the Validate One Required box there.Bob
I finally did it after a few more googling.
<div>
<input type="radio" name="fm" value="1" id="radiooo_0" /> 1 <br /> <input type="radio" name="fm" value="2" id="radiooo_1" /> 2 <br /> <input type="radio" name="fm" value="3" class="validate-one-required" id="radiooo_2" /> 3 <br /> </div>
Worked perfectly! By the way, it's 'validate-one-required', not 'validate_one_required'
*I'm wondering what you use Validate One Required box in CF validation tab for then? It doesn't really work at the moment, since it'll just add 'class="validate-one-required" to every radio buttons with the same name.
another point, what if you added it to the first radio and not the last one, does it work ?
Cheers
Max
Adding the class to the first radio button works, too.
Max
<p><div>
<label>
<input type="radio" name="commission" id="Planning" value="Planning" tabindex="10" />
Planning</label>
<label>
<input type="radio" name="commission" id="Parks-Recreation" value="Parks-Recreation" tabindex="11" />
Parks & Recreation</label>
<label>
<input type="radio" name="commission" id="Airport" class="validate-one-required" value="Airport" tabindex="12" />
Airport</label></div>
</p>
My form is here
All submissions go to me, so feel free to try it out as much as you want. Thanks for any help or suggestions!
When you post please say clearly what the problem is. Mind-reading takes too long! In this case I guess that the radio button isn't validating with 'validate-one-required'. There is or was a bug in the validation.js file - the fix is in the forums. You need to add a few lines to the code.
Bob
Later: I've attached the fixed version of mooValidation.js, unzip and replace the existing file in the com_chrnocontact/js folder
Thanks Bob!!
Cheryl
I am using Chronoforms V3.0 BETA 2 with Joomla 1.5.6.
I am not able to get validation working on radio buttons. This is the code I am using:
<p>*Is this your first event?
<div>
<input type="radio" name="CUSTOM5" value="Yes" id="First_Event_0" /> Yes <br />
<input type="radio" name="CUSTOM5" value="No" class="validate-one-required" id="First_Event_1" /> No <br />
</div>
</p>
I have uploaded the new mooValidation.js file from the link above but it does not help either.
I have left the validate-one-required field in the Validation tab empty as advised above, since it did not work either.
Any ideas?
Thanks.
<div>
<p><input type="checkbox" name="terms" value="AGREE"> I have read
the <a target="_blank" href="http://www.colvinrunpto.org/content/view/57/76/">terms and conditions</a> and indicate my electronic signature and acceptance of these terms and conditions.</p>
</div>
Note that I read somewhere the fields you want in this verify should be in a separate div... so you might want to try that.
Then I have the new mooValidation.js (which I believe you also have), and in the tab, validation,
Enable Validation=YES
Select Validation Library=mootools
12- Radio/Checkbox=terms (name of the field...not sure if you will need both)
Note I do not have the validate-one-required. I am just using the validation tab and it seems to work.
Hope this helps,
Cheryl