2 Replies Latest reply on Aug 30, 2007 12:15 PM by Newsgroup_User

    pass value in flex

    Level 7
      Hi All,
      I have a page that I insert records in my database. Then I display those
      records in a datagrid and show all.
      Now I wan to select one from the datagrid and edit using the same form as
      the insert but replace the values.
      I can change the stage on my button from ADD to UPDATE, but how to pass my
      recordID value calling the record from a link in my datagrid?
      Please help
      Tks

      JFB


        • 1. Re: pass value in flex
          Bob Saggot Level 1
          a couple ways to get the object out that you want to edit...

          1)
          datagridname.selecteditem.DATANAME i.e.) products.selecteditem.ProductName
          then to change this you just say
          products.selecteditem.ProductName = "whatever i want to change it to";

          OR
          2)
          you take it straight out of the arraycollection or array (RECOMMENDED WAY)
          var num:Number = 0;
          productsCOLLECTION.getItemAt( num ).ProductName = "whatever you want" if arraycollection
          productsARRAY
          = "whatever you want"

          Something fancy would be...
          var num:Number = products.selectedItem.ID; // This gets the ID from the database
          productsCOLLECTION.getItemAt( num ).ProductName = "whatever you want" if arraycollection
          //adds the specific ID from array collection
          • 2. Re: pass value in flex
            Level 7
            Thank for you reply Bob.
            I can get the item... no problem.
            How can I open my inputForm.mxml from my ListForm.mxml and pass my item
            value and fill the input form base on my record ID.
            I know how to get the data from my cfc also.... but can find the way to pass
            a parameter value and fill the form.
            Rgds

            JFB

            "Bob Saggot" <webforumsuser@macromedia.com> wrote in message
            news:fb732v$ib5$1@forums.macromedia.com...
            >a couple ways to get the object out that you want to edit...
            >
            > 1)
            > datagridname.selecteditem.DATANAME i.e.)
            > products.selecteditem.ProductName
            > then to change this you just say
            > products.selecteditem.ProductName = "whatever i want to change it to";
            >
            > OR
            > 2)
            > you take it straight out of the arraycollection or array (RECOMMENDED WAY)
            > var num:Number = 0;
            > productsCOLLECTION.getItemAt( num ).ProductName = "whatever you want" if
            > arraycollection
            > productsARRAY
            = "whatever you want"
            >
            > Something fancy would be...
            > var num:Number = products.selectedItem.ID; // This gets the ID
            > from
            > the database
            > productsCOLLECTION.getItemAt( num ).ProductName = "whatever you want" if
            > arraycollection
            > //adds the specific ID from array collection
            >