2 Replies Latest reply on Nov 22, 2008 10:26 AM by LinkMc

    Passing Form Vars to a CFC

    rob_parkhill
      I am trying to pass Form variables to a CFC. Yes, the CFC works being called from Flex, with no arguments, but being new to Flex I am not sure how to post the values in the form fields back to the CFC. So my questions are:

      1) how do you reference form variables. They are all enclosed in a form tag, and then by form item tags, I have a variety of types of inputs

      2) How do you pass that information to the cfc? Currently I am using this code: getSearch.getSearch.send({values:vals});
      In an attempt to pass an array full of values to the CFC.

      Any help would be great!

      Thanks,

      Rob
        • 1. Re: Passing Form Vars to a CFC
          LinkMc Level 1
          I know exactly where you are coming from...LOL..
          I was there too. Here is what you can do to make it easy on you.

          You wrap them in an object.... It is as simple as that.

          say that you have multiple form items.
          if you are using a data typed object ( I recommend it) you would do something like this to pass form data to a cfc
          //*******************************************//
          // This creates a data typed object called object.
          //
          //*******************************************//
          var obj:AS01Phone = new AS01Phone;


          //Populate the data typed object with your form data
          obj.UserID = Number(userid);
          obj.PhoneType = String(_phoneType.selectedItem.KeyValue);
          obj.DialCode = Number(_dialCode.selectedItem.DialCode);

          // Now send it to the cfc for processing
          // [RemoteObject.method(object);]
          roPhone.save(obj);
          • 2. Re: Passing Form Vars to a CFC
            LinkMc Level 1
            I know exactly where you are coming from...LOL..
            I was there too. Here is what you can do to make it easy on you.

            You wrap them in an object.... It is as simple as that.

            say that you have multiple form items.
            if you are using a data typed object ( I recommend it) you would do something like this to pass form data to a cfc
            //*******************************************//
            // This creates a data typed object called object.
            //*******************************************//
            var obj:AS01Phone = new AS01Phone;


            //Populate the data typed object with your form data
            obj.UserID = Number(userid);
            obj.PhoneType = String(_phoneType.selectedItem.KeyValue);
            obj.DialCode = Number(_dialCode.selectedItem.DialCode);

            // Now send it to the cfc for processing
            // [RemoteObject.method(object);]
            roPhone.save(obj);