Results 1 to 2 of 2

Thread: onSubmit

  1. #1
    Join Date
    Dec 1969

    Default onSubmit

    Here is the situation:<BR>I have a form that uses onSubmit to call a function to validate the form data. The form doesn&#039;t use a submit button to submit the form though. It uses a hyperlink like so:<BR>&#060;a href="document.frmName.submit();"&#062;Submit&#060 ;/a&#062;<BR><BR>My form tag looks like so:<BR>&#060;form name="frmName" method="post" action="page1.asp" onSubmit="return ValidateForm();"&#062;<BR><BR>The problem is that when the user clicks on the hyperlink, the form submits, but it doesn&#039;t hit the ValidateForm function. Any ideas why???<BR><BR>FYI, I have commented out the entire ValidateForm function so that is looks like so:<BR>function ValidateForm() {<BR> alert("ValidateForm called");<BR> return false;<BR>}

  2. #2
    Join Date
    Dec 1969

    Default Yep, always true!

    *ALL* the onXXX events in tags in the browser are *ONLY* invoked when a *user action* causes the event.<BR><BR>But your answer is simple:<BR><BR>&#060;A HREF="javascript:if (ValidateForm()) document.frmName.submit();"&#062;<BR><BR>

Posting Permissions

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