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.
Code:
<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"/>