• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

coldfusion ajax submit form to cfc

Guest
Jan 19, 2010 Jan 19, 2010

Copy link to clipboard

Copied

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">

</cfform>

TOPICS
Advanced techniques

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 19, 2010 Jan 19, 2010

Copy link to clipboard

Copied

LATEST

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';
        setTimeout("HideOpenMenus()",5000);
}
   
    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>";   
    }

</script>

let me know if you have any questions reagarding this

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation