I’m trying to find out if a Flash application can create a POST request, where some of the names of the posted items include the “.” character?
The background:
I’m working with someone who is writing a Flash application that has to POST data to the server. I’m working on the web application which receives and saves the data. As such, I know little about the inner workings of Flash myself.
To allow automated data-binding at the server (within Microsoft MVC), I want the names of the POST items to use a particular naming convention. So if I want to receive the results of two tests, I would like the POST items to use the names:
Tests[0].Score
Tests[0].Passed
Tests[1].Score
Tests[1].Passed
If this data was being submitted from a plain-old HTML form, this would be something like:
<input id="Areas_0__Score" name="Tests[0].Score" type="text" value="70" />
<input id="Areas_0__Passed" name="Tests[0].Passed" type="text" value="true" />
However, the developer says that when constructing a POST request within Flash, any items with a “.” in the name are ignored, and not included in the POST request.
Is this a known limitation of Flash, or should it be possible to include a “.” in the POST item names, as I would like?
Thanks for in advance for any ideas.
The AS3 URLVariables object used to create the post variables is a object. With falsh’s syntax, something like foo.bar would mean bar is a descendent/child/property of the foo object. URLVariables are, ultimately, objects also, thus something like Tests[0].Score is not the a valid name for an object. See this example: URLVariables examples
Especially:
Makeing a variable like you suggest would not work because of this dot syntax used for object properties/descendants:
variables.Tests[0].Scorewould, to Flash, mean something like: Thevariablesobject has a property calledTest[0], which has a property calledScore– which makes no sense/is faulty actionscript. As Flash converts the URLVariables object with its attributes into the actual HTTP post, it fails when the attributes have attributes.