2 Replies Latest reply on Mar 7, 2008 11:52 AM by MMFranklin

    ColdFusion.Ajax.submitForm ResultHandler Question

    MMFranklin Level 1
      I am developing an CF Ajax based solution in which I use ColdFusion.Ajax.submitForm to pass form values to a CFC for processing via Java Script. My question is related to the Java Script resultHandler and whether or not there is an easy way to return the results from the CFC to handler.

      My Java Script looks like this...
      function InsertRec() {
      ColdFusion.Ajax.submitForm('MyForm', 'service.cfc?method=InsertRec', resultInsertHandler, resultErrorHandler);

      My CFC looks like this.. (condensed)
      <cffunction name="insertRec" access="remote" output="no" returntype="numeric">
      <cfargument name="NAME">
      <cfargument name="Phone">

      <cfquery name="recInsert" datasource="#request.DS#">
      <cfset NEW_NUMBER = updatedNum( )> <-- Getting new # from another table via CFC

      Values (' #NEW_NUMBER# ' , ' #ARGUMENTS.NAME# ' , ' #ARGUMENTS.PHONE# ' )

      <cfreturn NEW_NUMBER>

      What I'm trying to do is return the value of NEW_NUMBER from the CFC back to resultInsertHandler so I can use it in a Java Script alert msg. Any ideas or thoughts would be greatly appreciated.


      Martin Franklin