HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 24th, 1999, 12:32 PM
marianaandr
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
hi, i'm mariana
i need to validate the checkbox or a drop out menu in the form.
I have 3 checkboxes and the user will choose just one, but how do I make sure that the form cannot be submitted unless they checked one of the boxes?
please, help
thank you

Reply With Quote
  #2  
Old May 24th, 1999, 03:53 PM
webcoder
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:


You can do a simple 'if' statement like:

<script>
function checkIt() {
if (document.forms[0].check1.checked == false && document.forms[0].check2.checked == false && document.forms[0].check3.checked == false) {
alert('no');
}
else { alert('yes') }
}
</script>

------------------

______________________
Matthew J. Flynn

w e b c o d e r
http://webcoder.net

Reply With Quote
  #3  
Old May 25th, 1999, 09:43 AM
scollo
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Mariana:

I wrote a sample form validation script last week. It demonstrates how the validation works with the FORM tag:

http://www.devshed.com/Talk/Forums/Forum3/HTML/000018.html

Also, I would suggest using radio buttons instead of checkboxes if you are trying to enforce selection of only one item.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Form Validation

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap