I was looking at the code for the Form and I think it could be handy
if instead of assembling the message as a JSON string and send it as a
post, you could use method setForm of Connection Manager (http://
developer.yahoo.com/yui/connection/#forms). Eventually, this would
allow to upload files, which you can't otherwise.
All server scripting libraries have support for URL-encoded arguments
and doing it using JSON adds a needless complexity. Even if you do it
by code as you currently do, it is better is you use URL-encoding, it
was server scripting languages would naturally expect. It is what you
have to do first anyhow to get the JSON data to then decode. Two
decoding steps.
If the value to be sent is different from the value as seen in the
input control the user sees, you could set a separate hidden input
field with the converted value. setForm won't send any input controls
without a name attribute so by not putting a name on it, you can
exclude a field from being sent.
Anyway, the way it is done, if you place an = or a &, it will break
the JSON message. You have to use JavaScript methods escape or
encodeURIComponent on that JSON string before placing it on the URL.
Also, your code is not adding the name=value of the submit button
itself. There might be forms with different actions represented by
different submit buttons and you have to know which one was clicked.
Besides, that is the expected behavior.
The Form object should also have a renderHidden just as it has a
renderButtons so that you can specify extra hidden fields to be sent
along the form.