5 Replies Latest reply on Jun 21, 2006 4:26 PM by The ScareCrow

    Inserting data into SQL throguh CF flash forms

    reya276
      I have a multi tab form and I need to insert data into an SQL database but I can only one submit button, because if I have multiple then the actual validations for the tab forms get in the way os submiting each other, so I wanted to use the flash remote option through a coldfusion component to pass the data to the DB, my issue is that I have no clue as to how to do this (do not know ActionScript) can anyone point me to a web site or some where I can find some sample code. I have found tons of articles of how to insert or pass data to FLash, but what I'm looking for is how to pass data into a coldfusion form and back, and yes I have tried the site called ASFusion, there they only show how to retrieve the information not insert. If any one can help please let me know, thanks.
        • 2. Re: Inserting data into SQL throguh CF flash forms
          reya276 Level 1
          I would say it's more Flex than action script since some of the methods used in action script will not always work on colfusion forms. So it's not a matter of knowing or learning action script, it's a matter of someone pointing me in the right direction. But thanks for your response it was very informative.
          • 3. Re: Inserting data into SQL throguh CF flash forms
            reya276 Level 1
            this is what I got so far:
            <cfsavecontent variable="checkValues">
            if (emp_NAMEa.text == '')
            {
            mx.controls.Alert.show('Employee Name is required!');
            }
            else if (FTa.text == '')
            {
            mx.controls.Alert.show('Employee Status is required!');
            }
            else if (TITLEa.text == '')
            {
            mx.controls.Alert.show('Employee Title is required!');
            }
            else if (DM_NAMEa.text == '')
            {
            mx.controls.Alert.show('District Manager Name is required!');
            }
            else if (DOHa.text == '')
            {
            mx.controls.Alert.show('Date of Hire is required!');
            }
            else if (SVC_MGR_NAMEa.text == '')
            {
            mx.controls.Alert.show('Service Manager Name is required!');
            }
            else
            {
            var responseHandler = {};

            //function that receives the response
            responseHandler.onResult = function( results: Object ):Void {
            //when results are back, we show the text received
            responseHandler.text = results;
            }
            var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection(" http://#cgi.HTTP_HOST#/flashservices/gateway/");
            //declare service
            var myService:mx.remoting.NetServiceProxy;
            //create load variables
            var formData = {};
            //add the input text to loadvars
            formData.emp_NAMEa = emp_NAMEa.text;
            formData.FTa = FTa.text;
            formData.TITLEa = TITLEa.text;
            formData.DM_NAMEa = DM_NAMEa.text;
            formData.DOHa = DOHa.text;
            formData.SVC_MGR_NAMEa = SVC_MGR_NAMEa.text;
            formData.Send(" http://stericycleweb.com/cfc/add_emp.cfm", formData, "post");

            }
            </cfsavecontent>
            • 4. Re: Inserting data into SQL throguh CF flash forms
              reya276 Level 1
              this is what I got so far:
              <cfsavecontent variable="checkValues">
              if (emp_NAMEa.text == '')
              {
              mx.controls.Alert.show('Employee Name is required!');
              }
              else if (FTa.text == '')
              {
              mx.controls.Alert.show('Employee Status is required!');
              }
              else if (TITLEa.text == '')
              {
              mx.controls.Alert.show('Employee Title is required!');
              }
              else if (DM_NAMEa.text == '')
              {
              mx.controls.Alert.show('District Manager Name is required!');
              }
              else if (DOHa.text == '')
              {
              mx.controls.Alert.show('Date of Hire is required!');
              }
              else if (SVC_MGR_NAMEa.text == '')
              {
              mx.controls.Alert.show('Service Manager Name is required!');
              }
              else
              {
              var responseHandler = {};

              //function that receives the response
              responseHandler.onResult = function( results: Object ):Void {
              //when results are back, we show the text received
              responseHandler.text = results;
              }
              var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection(" http://#cgi.HTTP_HOST#/flashservices/gateway/");
              //declare service
              var myService:mx.remoting.NetServiceProxy;
              //create load variables
              var formData = {};
              //add the input text to loadvars
              formData.emp_NAMEa = emp_NAMEa.text;
              formData.FTa = FTa.text;
              formData.TITLEa = TITLEa.text;
              formData.DM_NAMEa = DM_NAMEa.text;
              formData.DOHa = DOHa.text;
              formData.SVC_MGR_NAMEa = SVC_MGR_NAMEa.text;
              formData.Send(" http://www.stericycleweb.com/cfc/add_emp.cfm", formData, "post");

              }
              </cfsavecontent>