Serialize multi-select values as an array#101
Open
patrickbajao wants to merge 8 commits intomarionettejs:minorfrom
Open
Serialize multi-select values as an array#101patrickbajao wants to merge 8 commits intomarionettejs:minorfrom
patrickbajao wants to merge 8 commits intomarionettejs:minorfrom
Conversation
…is-docker Allows travis to use docker images for testing
…me-cicular-refs Fixes marionettejs#33
…-checkboxes An indeterminate checkbox will be a null value
Contributor
|
Thanks for the great work @patrickbajao Could you discuss the cross over of this one with #34? |
Author
|
You're welcome @rhubarbselleven! :) I'm not entirely sure what's the connection of my issue with that one. I think it's a different issue because I don't really have nested attributes. Though looks like my changes in this pull request might conflict with any changes that needs to be done on that issue. It seems that the fix for that requires modifying |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I have a multi-select in one of my forms. I started using Backbone.Syphon to serialize that form and I realized that it wasn't returning the values I am expecting. Before this change, it's returning the values of a multi-select as a nested array:
When submitting this format of serialized data to my backend (using Rails) via AJAX, the URL encoded value will be
foo%5B0%5D%5B%5D=bar1&foo%5B0%5D%5B%5D=bar2. That looks weird and that's not what I am expecting.My expected output is:
Which will be
foo%5B%5D=bar1&foo%5B%5D=bar2when URL encoded.Regarding the fix found in this pull request, I updated the
assignKeyValuemethod to push each value into the array instead of pushing the array into an array to avoid the nested array output. I also added a spec for that and hopefully that helps in explaining my case further. All tests are still passing with these changes.If I'm still missing something or if I need to change something else, please let me know. :)
Thanks,
Patrick