Calling Multiple functions

Results 1 to 2 of 2

Thread: Calling Multiple functions

  1. #1
    Join Date
    Dec 1969

    Default Calling Multiple functions

    I&#039;ve got the following 2 functions which I want to call OnSubmit but only the first function is being called, I could combine them but it would defeat the purpose ... Any ideas ?<BR><BR>Thanks in advance<BR><BR>&#060;form method="POST" name="frmApprove" onSubmit=" return checkSubmit(); ConfirmSubmit(&#039;Submit Form&#039;)" action="ApproveUpdate.asp"&#062;<BR><BR><BR>&#060; SCRIPT language=JavaScript &#062; <BR>&#060;!-- Hide Script from Old Browsers<BR><BR>var submitcount=0; <BR><BR>function checkSubmit() <BR>{ <BR><BR>if (submitcount == 0) <BR>{ submitcount++; return true; } <BR>else <BR>{ alert(&#039;This form has already been submitted.&#039; ); return false; } <BR>} <BR><BR><BR>function ConfirmSubmit(txtMsg) {<BR><BR> if (confirm(txtMsg)){<BR> document.FormName.submit()<BR> } else {<BR> return false<BR> }<BR>}<BR><BR>//End Hiding of Script from Old Browsers --&#062;<BR>&#060;/SCRIPT&#062; <BR>

  2. #2
    Join Date
    Dec 1969

    Default Never going to work...

    You can&#039;t submit two forms from a single page. Only one of the submits will actually succeed.<BR><BR>As your code is written, if you did succeed in invoking both functions then the form named "FormName" (wherever it is) would be submitted and the frmApprove would be ignored.<BR><BR>If your ConfirmSubmit() function were *not* submitting the form, then you could do:<BR><BR>&#060;form method="POST" name="frmApprove" action="ApproveUpdate.asp"<BR>onSubmit="return checkSubmit() && ConfirmSubmit(&#039;Submit Form&#039;);" <BR>&#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