Reputation: 245
I am using Dojo Toolkit and I want form elements to serialize into array, something like this:
<div dojoType="dijit.form.Form" jsId="form">
<input dojoType="dijit.form.TextBox" name="id" type="text" value="1"></input>
<input dojoType="dijit.form.TextBox" name="array[]" type="text" value="value1"></input>
<input dojoType="dijit.form.TextBox" name="array[]" type="text" value="value2"></input>
</div>
serialize to:
{ "id" : 1, "array" : [ "value1", "value2" ] }
Is it possible?
By the way, I'm using dojo.toJson(form.get('value'))
for serialzing.
Upvotes: 4
Views: 2180
Reputation: 69934
Perhaps dojo.formToObject or dojo.formToJson are what you are looking for?
Upvotes: 3