ChocolateDeluxe
New Member
I have a simple HTML files with book seats field as array , the code below\[code\]<input type="checkbox" name="book[]" value="http://stackoverflow.com/questions/9601335/<?php echo $i; ?> /><?php echo $i; ?><input type="submit" value="http://stackoverflow.com/questions/9601335/BOOK" onclick = "checkIfSeatEmpty()" />\[/code\]The javascript I used to validate if the field \[code\]book\[/code\] is empty is:\[code\]var x=document.forms["bkfrm"].getElementById("chkbx").value; //alert(x); alerts 'undefined' !// var x=document.forms["bkfrm"].getElementById("book").length; alert(x); if (x==null || x=="") { alert("First name must be filled out"); return false; }return TRUE;\[/code\]But the above code alerts as \[code\]undefined\[/code\] ! How can I check if the field is empty?