Forum : hi,can any one tell me how to validate the dropdown box? and why the below code not working?
Brief description  about Online courses   join in Online courses
View vinaykumar B patil 's Profile

hi,can any one tell me how to validate the dropdown box? and why the below code not working?

<html>
<head>
<title>WebCheatSheet - JavaScript Tutorial</title><script>
function validateFormOnSubmit(theForm) {
alert("dfdsf");

var reason = " ";
reason =validateuniversity(theForm.univer);
if (reason != "") {
alert("Some fields need correction:\n" reason);
return false;
}

return true;
}

function validateuniversity(fld){
var error = "";
if(fld.value== Select answer )
{

error= "dddddfdfdffs";


}
return error;
}
</script>
<body>
<form name="demo" onsubmit="return validateFormOnSubmit()" action=" ">


<fieldset>
Asked by vinaykumar B patil | Dec 23, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi vinay,

do mail ur code at vishwanath@siliconindia.com
Dec 26, 2010