I am using the validation script below as part of a larger script for a sales form. At the bottom of the sales page I have a button that runs a function to open a printable page. I need to validate the form fields on the form before proceeding to the printable page. If I leave one of the fields blank...say the email address...it gives me the correct alert box telling me to fill in the email address, but after I close the alert box it goes brings up a blank page with 'False' written at the top. Can you tell me how I can get the focus to go back to the field that failed the validation???
Thanks
function formCheck()
{
if (document.Sales.email.value.indexOf("@"
== -1 ||
document.Sales.email.value == ""
{
alert("Please include a proper email address."
;
return false;
}
if (document.Sales.user_name.value == ""
{
alert("Please put in a name."
;
return false;
}
}
Thanks
function formCheck()
{
if (document.Sales.email.value.indexOf("@"
document.Sales.email.value == ""
{
alert("Please include a proper email address."
return false;
}
if (document.Sales.user_name.value == ""
{
alert("Please put in a name."
return false;
}
}