Radio validation problem

Post any questions you may have here

Radio validation problem

Postby Noterious on Mon May 12, 2008 10:04 pm

I searched all over, but still couldn't find what's wrong with my form.

Let's say I have a form like
Code: Select all
<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.
Noterious
Fresh Boarder
 
Posts: 12
Joined: Tue Apr 08, 2008 6:27 pm

Re:Radio validation problem

Postby GreyHead on Tue May 13, 2008 8:45 am

Hi Noterious,

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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Radio validation problem

Postby Noterious on Tue May 13, 2008 8:54 am

Thanks Bob,

Yes, I'm trying to use ChronoForms validation for the radio buttons.

By using <div> Do you mean something like this?
Code: Select all
<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?
Noterious
Fresh Boarder
 
Posts: 12
Joined: Tue Apr 08, 2008 6:27 pm

Re:Radio validation problem

Postby GreyHead on Tue May 13, 2008 9:42 am

Hi Noterious,

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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Radio validation problem

Postby Noterious on Tue May 13, 2008 2:47 pm

Thank you for pointing me to the right direction, 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.
Noterious
Fresh Boarder
 
Posts: 12
Joined: Tue Apr 08, 2008 6:27 pm

Re:Radio validation problem

Postby admin on Tue May 13, 2008 3:46 pm

Good catch, do you have the latest version ? if yes then did you make sure it adds this to all radios ? if yes then its a bug and I will try to find a fix!

another point, what if you added it to the first radio and not the last one, does it work ?

Cheers

Max
ChronoForms Developer Thanks for using ChronoForms.
If you have any problems with ChronoForms please tell us.
If you like ChronoForms please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
User avatar
admin
Platinum Boarder
 
Posts: 2313
Joined: Mon Aug 14, 2006 5:29 am

Re:Radio validation problem

Postby Noterious on Tue May 13, 2008 4:05 pm

I'm using CF V.2.3.9, and yes, it does add 'validate-one-required' class to all radios.

Adding the class to the first radio button works, too.
Noterious
Fresh Boarder
 
Posts: 12
Joined: Tue Apr 08, 2008 6:27 pm

Re:Radio validation problem

Postby admin on Tue May 13, 2008 4:41 pm

Thanks loads!!

Max
ChronoForms Developer Thanks for using ChronoForms.
If you have any problems with ChronoForms please tell us.
If you like ChronoForms please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
User avatar
admin
Platinum Boarder
 
Posts: 2313
Joined: Mon Aug 14, 2006 5:29 am

Re:Radio validation problem

Postby hicksticks2001 on Thu Jun 26, 2008 10:16 pm

Any Idea what I am doing wrong on this?
Code: Select all
<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!
hicksticks2001
Fresh Boarder
 
Posts: 9
Joined: Thu Jun 26, 2008 8:28 pm

Re:Radio validation problem

Postby GreyHead on Fri Jun 27, 2008 9:27 am

Hi hicksticks2001,

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
Attachments
mooValidation-f106e5cc6eec4c60fc367e09291027dd[1].zip
(2.75 KiB) Downloaded 20 times
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3253
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re: Radio validation problem

Postby cjmicro on Mon Aug 18, 2008 5:28 pm

FWIW, I downloaded the new validations js file Bob referenced, installed it and voila' my checkbox validation is now working.

Thanks Bob!!

Cheryl
cjmicro
Senior Boarder
 
Posts: 60
Joined: Mon Apr 21, 2008 10:52 pm

Re: Radio validation problem

Postby chakatz on Thu Aug 28, 2008 2:02 am

Hi,
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:

Code: Select all
<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.
chakatz
Fresh Boarder
 
Posts: 3
Joined: Thu Aug 21, 2008 8:50 pm

Re: Radio validation problem

Postby cjmicro on Thu Aug 28, 2008 11:37 am

This is how I have mine set up (it is a checkbox, not radio)

Code: Select all
<div>
<p><input type="checkbox" name="terms" value="AGREE"> &nbsp; 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
cjmicro
Senior Boarder
 
Posts: 60
Joined: Mon Apr 21, 2008 10:52 pm


Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: Google [Bot], michaelc and 2 guests