Avatar of nmarano
nmarano

asked on 

validate checkbox

Experts-

Can someone help me with ensuring that at least one check box is selected?

<td width="110"><input type="checkbox" class="checkbox" name="windows" value="Windows" /><label for="windows">Windows</label></td>
<td width="130"><input type="checkbox" class="checkbox" name="gutterhelmet" value="Gutter Helmet" /><label for="gutterhelmet">Gutter Helmet</label></td>
</tr>
<tr>
<td width="110"><input type="checkbox" class="checkbox" name="roofing" value="Roofing" /><label for="roofing">Roofing</label></td>
<td width="130"><input type="checkbox" class="checkbox" name="icedefense" value="Ice Defense" /><label for="icedefense">Ice Defense</label></td>
</tr>
<tr>
<td width="110"><input type="checkbox" class="checkbox" name="siding" value="Siding" /><label for="siding">Siding</label></td>
<td width="130"><input type="checkbox" class="checkbox" name="drenergy" value="Dr. Energy Saver" /><label for="drenergy">Dr. Energy Saver</label></td>

Any help would be appreaicted

Thanks
Nick
JavaScript

Avatar of undefined
Last Comment
nmarano
Avatar of Big Monty
Big Monty
Flag of United States of America image

here's a good approach if you have the option to use jQuery and the validator plug-in:

http://stackoverflow.com/questions/11512448/validation-for-at-least-one-checkbox
ASKER CERTIFIED SOLUTION
Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of nmarano
nmarano

ASKER

Big- Thanks, but I am unable to use jQuery.

chaituu-  Thank you!  The code works perfectly.  One last question, is there a way for me to remove where the pop up says, "The page at ....." and only have it say Please select at least one check box?

THanks
Nick
image002.png
actuallly am not getting that pop up ;may be you need to chnage some settings in the browser.i have tested in IE8 and not getting any popup message like that.
Avatar of nmarano
nmarano

ASKER

Thank you very much for your help!
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo