Hi all,
Array Check box validation ...
<html>
<head>
<script type="text/javascript">
function validate_array_checkbox(form_object,checkbox_name){
var total=0;
for(var i=0; i < form_object[checkbox_name].length; i++)
{
if(form_object[checkbox_name][i].checked)
{
return true;
}
}
alert("Please select your place") ;
return false;
}
</script>
</head>
<body>
<form method="post" onSubmit="return validate_array_checkbox(this,'pl[]');">
<input type="checkbox" name="pl[]" value="Chennai" />Chennai
<input type="checkbox" name="pl[]" value="Madurai" />Madurai
<input type="checkbox" name="pl[]" value="Delhi" /> Delhi
<input type="submit" value="Validate" />
</form>
</body>
</html>
No comments:
Post a Comment