View Single Post
  #3 (permalink)  
Old 03-15-05, 04:33 PM
djwayne_2004 djwayne_2004 is offline
Newbie Coder
 
Join Date: Jan 2005
Location: England
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

To fix your problem change your form tag value to:

Code:
<form method="post" action="process.asp" name="sform" onSubmit="return checkForm(this); return false;">
And change your javascript to:

Code:
function checkForm(f)
{
    if (f.elements['FieldName1'].value == "" && f.elements['FieldName2'].value == "")
    {
        alert("You have not specified the products you wish to order please go back to step 2");
        return false;
    }
    else
    {
        f.submit();
        return false;
    }
}
This should now stop the form from being submitted unless both fields have something in them. Hope this helps.

Wayne
Reply With Quote