Click to See Complete Forum and Search --> : Box not filled in


NZ_Kiwis
03-25-2006, 12:46 AM
I want a code so when a textbox has no text in it and a user click the submit button it pops up saying you have not filled in the box!!!

i need to code to be able to have a number of boxes that need information

bradgrafelman
03-25-2006, 01:19 AM
<script type="text/javascript">

function checkIt() {

f = document.theForm;

if(f.whatever.value == '' || f.etc.value == '') {
alert('Error: You must fill out all required fields.');
return false;
} else return true;

}
</script>
<form name="theForm" onsubmit="return checkIt()">
<textarea name="whatever"></textarea>
<input type="text" name="etc" />
</form>