...

View Full Version : Form validator Issue



Jacobb123
01-28-2008, 06:16 PM
I have the following code that validates a select box I have. It works but I want to change it to check two select boxes and also it still submits the form after the alert comes up.


<input name="submit" type="submit" value="Post Question" onclick="madeSelection(document.getElementById('forums'), 'Please Choose a forum sub category')" />


<script type='text/javascript'>
function madeSelection(elem, helperMsg){
if(elem.value == 'Please Choose'){
alert(helperMsg);
elem.focus();
return false;
}else{
return true;
}
}
</script>

Philip M
01-28-2008, 07:04 PM
<input name="submit" type="submit" value="Post Question" onclick="return madeSelection(document.getElementById('forums'), 'Please Choose a forum sub category')" />

Jacobb123
01-28-2008, 07:21 PM
How can I make it so that it will validate two select boxes?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum