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: 10:54 - Apr 27, 2010
mkronix
hi guys, i have a form with input text, dropdown menu and groups of radio button. the validation for input text and dropdown menu works fine with these js validator - <script language="JavaScript"> function formValidator(){ // Make quick references to our fields var pensyarah = document.getElementById('pensyarah'); var kksem = document.getElementById('kksem'); // Check each input in the order that it appears in the form! if(madeSelection(pensyarah, "Sila pilih Pensyarah")){ if(madeSelection(kksem, "Sila pilih Kod kursus")){ return true; } } return false; } function isEmpty(elem, helperMsg){ if(elem.value.length == 0){ alert(helperMsg); elem.focus(); // set the focus to this input return true; } return false; } function isNumeric(elem, helperMsg){ var numericExpression = /^[0-9\s\:]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphabet(elem, helperMsg){ var alphaExp = /^[a-zA-Z\s\.]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphanumeric(elem, helperMsg){ var alphaExp = /^[0-9a-zA-Z\s]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function madeSelection(elem, helperMsg){ if(elem.value == "*Tiada Pilihan"){ alert(helperMsg); elem.focus(); return false; }else{ return true; } } function emailValidator(elem, helperMsg){ var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(elem.value.match(emailExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } </script> my question is.. how to do the group of radio button validation inside the existing js validator.. is it posible to merge it in one function? this is my form code: http://www.modernessence.net/e1flashz/im... this is how the form looks like http://www.modernessence.net/e1flashz/im... any ideas.. Thank you in advance. (sorry for my english, i'm from malaysia)
Categories:
Add Categories
When adding more than one category, separate them with commas.
This question has not yet been answered.
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 do validation for a number field by javascript
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