1 Reply Latest reply on Jan 19, 2010 1:28 PM by TiGGi

    coldfusion ajax submit form to cfc


      I am attempting to learn Ajax and have come across a problem. I want to submit the form values to a method. The code below succesffully contacts the cfc and the function however the form values are not being passed. I feel like I have tried everything I know to try. I would also like to inquire about a good place or good book to really learn Ajax and in particular Coldfusion and Ajax. (book or web site)


      <cfajaxproxy bind="cfc:invoice.putItems({Add@click})">
      <cfform name="formitems" id="formitems">

      <cfinput type="text" name="item1" value=""  />
      <cfinput type="text" name="item2"  value="" />

      <cfinput type="button" name="Add" value="Add" id="Add">


        • 1. Re: coldfusion ajax submit form to cfc
          TiGGi Level 1

          This is what I use to submit forms via ajax:


          <script type="text/javascript">
          function updateErrorHandler(id,message) {
                  alert("Error while updating\n Error code: "+id+"\n Message: "+message);   
              function doInsert(nForm) {   
                ColdFusion.Ajax.submitForm(nForm, '/doInsert.cfm?method=insertData', resultInsertHandler, insertErrorHandler, 'POST');         
              function resultInsertHandler(returnMsg) {   
                  var resultDiv = document.getElementById("result");
                  resultDiv.visibility = 'visible';
                  resultDiv.innerHTML = '<div>Success!</div>';
                  resultDiv.visibility = 'visible';
              function insertErrorHandler(id, message) {   
                 alert("Error while updating\n Error code: "+id+"\n Message: "+message);
                  var resultDiv = document.getElementById("result");       
                  resultDiv.innerHTML = "<p>Failed!</p>";   




          let me know if you have any questions reagarding this

          1 person found this helpful