onSubmit problems

Results 1 to 3 of 3

Thread: onSubmit problems

  1. #1
    Join Date
    Dec 1969

    Default onSubmit problems

    I have a javascript form validation script which is triggered by an onSubmit in the form tag.<BR>I also have an action="page2.asp" in the form tag.<BR><BR>How can I get the script to validate but let the user change their mistakes in the form before the page changes to page2.asp?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: onSubmit problems

    The JavaScript form validation script would be invoked in the <BR>form tag as follows: &#060;form name="frm" action="page2.asp <BR>method = "post" onsubmit= "return Valfrm();".<BR><BR>The script would have this format:<BR><BR>function ValFrm()<BR>{<BR>var blnFrm = true;<BR>if (document.frm.txt.value.length == 0)<BR> {blnFrm = false;}<BR>return blnFrm;<BR>}<BR><BR>The false return from the function prevents the post from happening.

  3. #3
    Pankaj Sharma Guest

    Default RE: onSubmit problems

    When you are calling the validation function, return false from the function as soon as validation is failed (before submit())and it will not submit the form.<BR>cheers,<BR>Panks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts