Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Open Points: 125 Time: 00:04 - May 29, 2007
mdjinna
validate the checkboxlist in the java script
Categories:
Add Categories
When adding more than one category, separate them with commas.
nidhi
Date:: Jan 29, 2009
Time:: 09:16
What do you mean by checkboxlist ? Unless that is something new, I am not sure of what that is. You either have one or more checkboxes, any of which can be selected or if you want just one choice then its a radio button choice
Time:: 09:32
Simple radio button validation. Form which asks you to select a fruit. Note, the form submit specifies to call a javascript function. In that I iterate thru the radio buttons, make sure the buttons have the same name In checkFruitEntered code, I set a variable to be -1. If a fruit is selected then I set it to that index. see the final if in that method. <html> <head><title>radio btn validation</title></head> <script language="JavaScript"> function checkFruitEntered() { var fruitSelected = -1; for (i = 0; i < quomonTest.rbtn.length; i++) { if (quomonTest.rbtn[i].checked) { fruitSelected = i; } } if (fruitSelected == -1) { alert("You didnt select a fruit!"); return false; } else { alert("You selected " + quomonTest.rbtn[fruitSelected].value); return true; } } </script> <body> <form name="quomonTest" onSubmit="return checkFruitEntered()"> Select A Fruit : <input type="radio" name="rbtn" value="apple">I like Apples <input type="radio" name="rbtn" value="pear">I need some Pears <input type="radio" name="rbtn" value="bananas">I love Bananas <br> <input type="submit"> </form> </body> </html>
Time:: 09:34
forgot to add, to get to the form variable in javascript, do the following <formname>.<field name> in this case, formname is quomonTest (code=<form name="quomonTest") and field is called rbtn (code=name="rbtn")
admin
Date:: Mar 24, 2009
Time:: 09:45
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points. The Quomon Team
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
checkboxlist
how to validate checkboxlist in js and to know how many checkboxes are checke...
How do I validate as required a checkboxlist in asp.net?
How to validate radio button for gender using javascript
Java Script
You have 100 characters to use
Rank
Expert
Points
1.
10279
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software