ericson <[EMAIL PROTECTED]> writes:

> I'd like to pass an array with "keys" to a PHP file through RPC.
>
> var record=[value1,value2,...];
> res = rpc.callSync("saveData", "mytable", record);
>
> it works well, but in fact I would like to retrieve in my PHP program an
> array like :
>
> record ["field1"=>value1, "field2"=> value2, ...]
>
> How I can specify "field1", "field2", ... with record variable in the
> javascript program, each time I tried something like {field1: value1}, ...
> the PHP program receive an object ?!

If you're using the PHP backend provided with qooxdoo, then the results you're
seeing are the intended results.  Javascript associative arrays are not
supported in JSON-RPC, so you can pass either a standard array (with index
starting at zero and incrementing by exactly one with each successive array
element, i.e. no sparse arrays), or you can pass an object.  The array gets
converted to a PHP array, and the object gets converted to a PHP object.

If you really need the object to be represented as an array, you should be
able to do an easy conversion in your application.  You could also modify the
PHP backend.  That's one of the benefits of open-source software. :-)

Cheers,

Derrell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to