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: 75 Time: 10:25 - May 04, 2009
claudio363
hi, i have a problem with radio button. i generate dinamically my radio button and if i have only one radio button i can't use the radio button length because it's undefined. Can i do for validate it?
Categories:
Add Categories
When adding more than one category, separate them with commas.
teddyjas
Date:: May 05, 2009
Time:: 08:51
what do you want to validate it? Do you mean you want to validate the value?
Muhammad Amman
Date:: May 06, 2009
Time:: 12:03
claudio in this way u validate the button of radio look simple program: </html> </head> <script type="text/javascript"> function valbutton(thisform) { // place any other field validations that you require here // validate myradiobuttons myOption = -1; for (i=thisform.myradiobutton.length-1; i > -1; i--) { if (thisform.myradiobutton[i].checked) { myOption = i; i = -1; } } if (myOption == -1) { alert("You must select a radio button"); return false; } alert("You selected button number " + myOption + " which has a value of " + thisform.myradiobutton[myOption].value); // place any other field validations that you require here thisform.submit(); // this line submits the form after validation } </script> </head> <body> <form name="myform"> <input type="radio" value="1st value" name="myradiobutton" />1st<br /> <input type="radio" value="2nd value" name="myradiobutton" />2nd<br /> <input type="radio" value="3rd value" name="myradiobutton" />3rd<br /> <br /> <input type="submit" name="submitit" onclick="valbutton(myform);return false;" value="Validate" /> <input type="reset" name="reset" value="Clear" /> </form> </body> </html>
Date:: May 11, 2009
Time:: 04:04
Hi, i buyild dinamically my radio button and when there is only one of this this javascript don't function. I post my solution for this ptoblem : function isOneCheked(objForm){ for(jj=0; jj<= objForm.check_user.length; jj++) { if(objForm.check_user[jj].checked) { break; return true; } } return false; } function sigleRadioValue(objForm){ if(objForm.check_user.checked){ return true; }else{ return false; } } function validateChekSelection(objForm){ if(!isOneCheked(objForm)) { if(!sigleRadioValue(objForm)){ window.alert("Selezionare almeno un utente"); return ; }else{ objForm.submit(); } }else { objForm.submit(); } }
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
How to validate radio button for gender using javascript
Radio button validation
how to validate gender by using radio button in java script
how can i select a radio button automaticaly by selecting a checkbox in java ...
Radio Button Validation
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