xperience3
IS-IT--Management
Hi,
I'm using this code:
function isEmpty(elem, helperMsg){
if(elem.value.length == 0){
alert(helperMsg);
elem.focus(); // set the focus to this input
return false;
}
return true;
}
and:
<input type="submit" name="submit" value="Continue to select you flight package" onclick="isEmpty(document.getElementById('customersname'), 'Please Fill in the form correctly')", onmouseover="return validate(terms)"/>
to check if a field on a web page has been filled in before submitting.
Only problem is, at the moment it gives the error but still submits the form.
How can I make it NOT submit the form if the error is shown?
Cheers
Simon
I'm using this code:
function isEmpty(elem, helperMsg){
if(elem.value.length == 0){
alert(helperMsg);
elem.focus(); // set the focus to this input
return false;
}
return true;
}
and:
<input type="submit" name="submit" value="Continue to select you flight package" onclick="isEmpty(document.getElementById('customersname'), 'Please Fill in the form correctly')", onmouseover="return validate(terms)"/>
to check if a field on a web page has been filled in before submitting.
Only problem is, at the moment it gives the error but still submits the form.
How can I make it NOT submit the form if the error is shown?
Cheers
Simon