|
-
May 15th, 2007, 05:58 AM
#1
Thread Starter
Member
how to validate radiobutton, checkbox n dropdown list?
i am trying to validate radiobutton but to no avail.
this is the code that i m currently using to validate radiobutton:
<script language="JavaScript">
function checkForm()
{
var cgender;
with(window.document.msg)
{
cgender = gender;
}
if(trim(cgender .value) == '')
{
alert('Please select ur gender');
cgender .focus();
return false;
}
else
{
cgender.value = trim(cgender.value);
return true;
}
}
</script>
<body>
<form method="post" name="msg">
Gender:
<input name="gender" type="radio" value="male" />
Male
<input name="gender" type="radio" value="female" />
Female
<input type="submit" name="submit" value="Submit"onClick="return checkForm();">
when i click onto the submit button, nothing happens.
can someone tell me what is wrong with my code? n can someone give me an example on how to validate checkbox and also dropdown list?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|