How to make Dojo form elements serialized into an array?

I am using the Dojo Toolkit, and I want the form elements to be serialized into an 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:

{ "id" : 1, "array" : [ "value1", "value2" ] }

Is it possible?

By the way, I use dojo.toJson(form.get('value')) for serialization.

+4
source share
1 answer

Perhaps dojo.formToObject or dojo.formToJson is what you are looking for?

+3
source

Source: https://habr.com/ru/post/1381174/


All Articles