Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: JavaScript
Expertise: Beginner
Aug 11, 2000

Selecting Three Radio Buttons

Question:
I want to validate a form so that three radio buttons may be checked, but no more. This will be used in a "what are your top three choices" type of situation

Answer:
Radio buttons are, by definition, a type of button where only one of a group can be checked. So, there's no way to do what you want with radio buttons.

However, you can fake this by either (a) setting all of your radio buttons to be in unique groups, so that changing one won't reset the others, or (b) using checkboxes instead. Either way, you'd then want to have an onSubmit handler that verifies that just three have been chosen.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date