I have a form looks a little like this
<form>
<input type='text' name='_id'/>
<input type='text' name='name'/>
<textarea name='description'/>
<input type='text' name='category'/>
<input type='checkbox' name='reservable'/>
<ol>
<li><input type ='text' name='_id'/><input type='text' name='name'/><input type='text' name='value'/></li>
<li><input type ='text' name='_id'/><input type='text' name='name'/><input type='text' name='value'/></li>
</ol>
</form>
I'm trying to use the serializeObject() method on this form and it's working well for the most part. Problem is I want the elements inside the list to be made into an array with each li element an object in the array like so..
{
_id:'5',
name:'bob',
description:'tall',
categoryId:'human',
reservable:'false',
attributes:
[
{
_id:'3',
name:'hair',
value:'brown'
}
]
}
What I'm getting now looks like this
{
"_id:":"5",
"name:":"bob",
"description:":"tall",
"categoryId":"human",
"name":["hair",""],
"value":["brown",""]
}
Is there a way I can get it to make attributes an array of objects? Also if somebody could tell me why my checkbox isn't showing up I'd greatly appreciate it.