alechill / livevalidation

Open source javascript library for slick, powerful, and easy client-side validation.
http://livevalidation.com
Other
151 stars 57 forks source link

Radio field ? #6

Open Imonda opened 13 years ago

Imonda commented 13 years ago

Hi there,

What about the radio field ? I think this feature is more than required.

Great script anyway.

Regards, Michael

theGeekPirate commented 13 years ago

What kind of validation would you need for a radio field when you can only select one? Can you give a use case? Note that you can easily disable radio fields in javascript (http://www.google.ca/search?gcx=w&sourceid=chrome&ie=UTF-8&q=disable+radio+button+javascript#sclient=psy-ab&hl=en&source=hp&q=disable+radio+button+stackoverflow&pbx=1&oq=disable+radio+button+stackoverflow&aq=f&aqi=&aql=1&gs_sm=e&gs_upl=1013l1013l1l1463l1l1l0l0l0l0l171l171l0.1l1l0&bav=on.2,or.r_gc.r_pw.&fp=1cea92fb4518212&biw=1920&bih=955).

serendipity2ltd commented 12 years ago

How do you use it to validate a radio button to make sure the user selects one option?

sstamenov commented 12 years ago

This is an example usecase:

< input type="radio" name="answer" value="one" /> in 1 restaurant < input type="radio" name="answer" value="two" /> in 2 restaurants < input type="radio" name="answer" value="five" /> in 5 restaurants < input type="radio" name="answer" value="nine" /> in 9 restaurants

So how do we make sure a user has clicked on one of the four options when there is no specific id that can describe all four options simultaneously?

cheers and keep up the good work!

outmoder commented 12 years ago

i'd like to see this too - same reason as above. make user select one of multiple options, when there is no obvious pre-selected option. maybe this should be a dropdown select menu in the html, but then can this be validated?