Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
Error while validating radio buttons, textfield and dropdown in a single form
Sawan Mishra
Ranch Hand
Posts: 47
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi everyone,
I want to validate radio buttons,textfield and dropdown in a single form but i'm not getting validation part.
cou;d anyone debug this and give correct code and if possible let me know my mistake.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Result and Award Management- Online Test Taking System</title> <script type="text/javascript"> function success() { alert("Award updated successfully"); return true; } function validateForm() { var a=document.forms["awardcreation"]["awardname"].value; var b=document.forms["awardcreation"]["awardamount"].value; var returnradio=false; var category=awardcreation.awardtype; var e = document.getElementById("awardcriteria"); var final = e.options[e.selectedIndex].value; if (a==null || a=="") { alert("Award name must be filled out"); return false; } else if (b==null || b=="") { alert("Amount must be filled out"); return false; } else if (final=='empty') { alert("Please select award criteria"); } else if ( ( awardcreation.awardtype[0].checked == false ) && ( awardcreation.awardtype[1].checked == false ) ) { alert ( "Please choose an award type" ); return false; } else { alert("Award updated sucessfully"); } }
thanks
with regards
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What the specific problem? Are you getting errors? Unexpected behavior? Have you set breakpoints to see what's happening?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
problem in validating multiple radioboxes in JS
Validate JSP form through JavaScript
struts-2 (set values to action class)
Stop Users from entering blanks in text form fiels
Webpage redirection problem
More...