1 Reply Latest reply: Nov 20, 2013 7:54 AM by BKBK RSS

    more than 1 function in cfform tag "onSubmit"

    ranger Community Member

      i need to call atleast 3 javascript functions in a form

       

      using "onSubmit" works fine with one function but when i try to add another nothing happens....

       

       

      <cfform

      action="postpage.cfm" method="POST"

      target="_self"

      onsubmit="if(document.getElementById('Agree').checked) { return true; } else { alert('You must agree to the Terms and Conditions'); return false; }">

       

       

      "return checkEmail(this);" is one of the funtions. it checks to see if 2 cfinputs are the same

       

      how do i add multiple functions to onSubmit

       

      tnx in advance

        • 1. Re: more than 1 function in cfform tag "onSubmit"
          BKBK Community Member

          ColdFusion is simply behaving as it should. You will notice that the script that currently runs upon onSubmit ends in a return-statement. That signals the end of the event-handler. 

           

          If you wish to check the e-mail as well, you could run one script that performs both functions. I was thinking of something like the following, just off the cuff

           

          onsubmit="if(!document.getElementById('Agree').checked) {alert('You must agree to the Terms and Conditions'); return false; } else {return checkEmail(this);}">