troubleshooting Question

convert array collection to string. The array has excess information.

Avatar of kadin
kadinFlag for United States of America asked on
Apache Flex
22 Comments1 Solution2864 ViewsLast Modified:
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.

I test this by inputing: sentence01 test. and sentence02 test. and click the button which converts the contents of the weatherInfo array object to a string that I can send to php.

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,

When I use  mx.controls.Alert.show("weather info="+ weatherInfo);. It says the same thing.

The weatherInfo array object has this (D3315A22-768D-F239-D0D6-729798515A31) additional information.

How do I get a string into php with just the input values (sentence01 test, sentence02 test,)? 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"/>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 22 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros