1 Reply Latest reply on May 22, 2012 1:44 PM by 56231

    convert array collection to string

    56231 Level 1

      This is a datagrid with two columns. I plan on having many columns. Each column input says add text here. When user clicks on that input,(add text here) gets replaced or updated with the user input. The columbs are editable, so if the user changes his mind the ArrayCollection gets updated.

       

      So I test this by inputing: sentence01 test. and sentence02 test. and click the button.

       

      The array is converted to a string and sent to php. PHP emails me the string and this is what I recieve:

      nullD3315A22-768D-F239-D0D6-729798515A31, sentence01 test, F55EA87E-A1B9-B9DF-2EC1-7297993BDD51, sentence02 test,

       

      Where is all this extra info coming from? All I want is the two sentences. Thanks.

       

      <s:HTTPService method="POST" resultFormat="e4x">

        <s:request xmlns="">

        <str>{str}</str>

      </s:HTTPService>

       

      [Bindable] private var weatherInfo:ArrayCollection = new ArrayCollection

                      ([{tex01:'add text here'}, {tex02:'add text here'}]);

      [Bindable] private var str:String;

       

      private function buttonHandler(event:Event):void {

        str = arrayCollectionToString(weatherInfo);

      }

       

      public static function arrayCollectionToString( weatherInfo:ArrayCollection ):String 

        { 

           var collStr:String;

           for each( var obj:Object in weatherInfo ) 

              { 

                 for each( var obj2:Object in obj ) 

                     { 

                         collStr += obj2.toString() + ", "; 

                     } 

              } 

            return collStr; 

        }

       

      <mx:DataGrid dataProvider="{weatherInfo}" editable="true">

              <mx:columns>

                  <mx:DataGridColumn headerText="tex01" dataField="tex01" editable="true"/>

                  <mx:DataGridColumn headerText="tex02" dataField="tex02" editable="true"/>

              </mx:columns>

      </mx:DataGrid>

       

      <s:Button id="btn" label="upload" click="buttonHandler(event)" enabled="true"/>

        • 1. Re: convert array collection to string
          56231 Level 1

          mx.controls.Alert.show("weather info="+ weatherInfo);

           

          nullD3315A22-768D-F239-D0D6-729798515A31, sentence01 test, F55EA87E-A1B9-B9DF-2EC1-7297993BDD51, sentence02 test,

           

          The weatherInfo array has this in it before it even gets to php. I am trying to turn the weatherInfo array object into a string that says this: sentence01 test, sentence02 test

           

          Can someone tell me where this extra information (D3315A22-768D-F239-D0D6-729798515A31) is coming from and how to remove it? Thanks.