i am validating 3 fields in html that they are empty or not .
the code is
<input type="file" id="uploadImage" name="image" />file1:
<input type="file" name="QRimage" id="File2" />file2:
<label for="name">Student information:</label>
<input type="checkbox" name="person" id="person" >Yes
javascript:
function validate()
{
var empt = document.forms["form1"]["image"].value;
var empt1 = document.forms["form1"]["QRimage"].value;
var empt2 = document.forms["form1"]["person"].value;
if (empt == "" && empt1 == "" && empt2 != "checked" )
{
alert("Please input a Value");
return false;
}
Problem: if those 3 fields are empty then its gives the alert message that ("please input a value") . but if checked the check box the allso its giving same message rather than going next page . where i am wrong ?
validate()? provide complete form (HTML).empt2will never be'checked', you've to compare][person].checked(which will be a boolean) instead ofvalue. What has PHP to do with this question?