Hi All,
I have a Submit button on the Form --When I open the form on the web , I have some validations to check if the Field is empty or not , but when I clcik it bypasses the validation even if the Fioeld is empty or with certain criteria
Please help
Here is the code behind the Submit button
var f = document.forms[0];
if (f.EntryType.checked == “Business Travel” && f.ArrivalTime.value == “”)
{
alert("Please enter Arrival Time in hh:mm format")
return false;
}
if (f.EntryType.checked == “Business Travel” && f.DepartTime.value == “”)
{
alert("Please enter Departure Time in hh:mm format")
return false;
}
// if (validateDate(f.EndDate, “EndDate”) == false)
// return false;
// if (validateSelect(f.HomeLocation, “HomeLocation”) == false)
// return false;
//if (validateSelect(f.DestinationLocation, “DestinationLocation”) == false)
// return false;
if (f.Duration.value == 0)
{
alert(“Duration needs to be greater than 0 , click the Calculate Button to calculate the Duration” )
return false;
}
if (confirm(“Are you ready to submit this form now?”))
{
f.Action.value = "Submit";
f.submit();
}
I get the alert for Duration, but I don’t get any alerts for the previous If condition.
Please help
Thanks in advance
ac ac