Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

In a javascript function invoked from an onsubmit handler, if the function returns false, the form is still submitted. If I find an error in a form, how do I cancel the submit?

  • 3 ردود
  • 1 has this problem
  • 10 views
  • آخر ردّ كتبه AnonymousUser

more options

HTML form has: action="/TTFFRP/addlicense.rex" method="get" onsubmit="validate_data();"

validate_data is defined in tags:

function validate_data()

 {                                                                                                    
   alert('in validate routine');                                                                      
   if (document.getElementById('custname').value == )                                               
     {                                                                                                
      alert('Customer name must not be blank; put in name of organization licensing File RePackager');
      return false;                                                                                   
     }                                                                                                                                         

}

HTML form has: action="/TTFFRP/addlicense.rex" method="get" onsubmit="validate_data();" validate_data is defined in tags: function validate_data() { alert('in validate routine'); if (document.getElementById('custname').value == '') { alert('Customer name must not be blank; put in name of organization licensing File RePackager'); return false; } }

All Replies (3)

more options

I have the exactly same problem

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. http://forums.mozillazine.org/viewforum.php?f=25 You'll need to register and login to be able to post in that forum.

more options

Make the onsubmit handler say "return validate_data();" so:



works!