error handling nested checkboxes as stringarray#45
error handling nested checkboxes as stringarray#45layerssss wants to merge 1 commit intomacek:masterfrom
Conversation
|
|
95e6d74 to
8d5742e
Compare
|
ok, it's mergable now! This patch properly handled nested array cases. |
|
The array "push" operator is not really meant to be used like that. Without a specific index, the serializer has no context to logically group items as you originally intended. The following form <input name="items[0][name]" value="foo">
<input name="items[0][types][]" value="dog">
<input name="items[0][types][]" value="cat">
<input name="items[1][name]" value="bar">
<input name="items[1][types][]" value="bat">
<input name="items[1][types][]" value="rat">Will generate {
"items": [
{
"name": "foo",
"types": [
"dog",
"cat"
]
},
{
"name": "bar",
"types": [
"bat",
"rat"
]
}
]
}Is this more along the lines of what you were going for? Because the For example, |
|
Thanks for the suggestion @macek ! But I really feel that there can be a simple rule for the
This rule is actually applied in my patch.
I'm not sure whether this format/usage is listed in any specs. But do you know is there a spec for this? |
|
@layerssss I sincerely appreciate the work and detailed information you put in here. There is actually a draft spec I'm currently working towards: W3C HTML JSON form submission. You can see more discussion about this in #24. I have an morning appointment so I'm going to generate more of a response for you a bit later today. Meanwhile, if you have a chance, take a look at that spec. |
Hi, this issue is illustrated in http://jsfiddle.net/x6fz3mgt/ .
The expected output is:
But the current output is: