-
Notifications
You must be signed in to change notification settings - Fork 0
pinge/jquery-rparam
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
simple proof of concept usage: $('form').rparam() examples: <input name="entity[attribute_1]" value="first" /> <input name="entity[attribute_2]" value="second" /> <input name="entity[attribute_3]" value="third" /> *becomes* { entity: { attribute_1: 'first', attribute_2: 'second', attribute_3: 'third' } } ---- <input name="entity[attribute_1][]" value="first" /> <input name="entity[attribute_1][]" value="second" /> <input name="entity[attribute_1][]" value="third" /> *becomes* { entity: { attribute_1: [ 'first', 'second', 'third' ] } } ---- <input name="entity[another_entity_attributes][][attribute_1]" value="1st first" /> <input name="entity[another_entity_attributes][][attribute_2]" value="1st second" /> <input name="entity[another_entity_attributes][][attribute_3]" value="1st third" /> <input name="entity[another_entity_attributes][][attribute_1]" value="2nd first" /> <input name="entity[another_entity_attributes][][attribute_2]" value="2nd second" /> <input name="entity[another_entity_attributes][][attribute_3]" value="2nd third" /> <input name="entity[another_entity_attributes][][attribute_1]" value="3rd first" /> <input name="entity[another_entity_attributes][][attribute_2]" value="3rd second" /> <input name="entity[another_entity_attributes][][attribute_3]" value="3rd third" /> *becomes* { entity: { another_entity_attributes: [ { attribute_1: '1st first', attribute_2: '1st second', attribute_3: '1st third' }, { attribute_1: '2nd first', attribute_2: '2nd second', attribute_3: '2nd third' }, { attribute_1: '3rd first', attribute_2: '3rd second', attribute_3: '3rd third' } ] } } ---- <input name="entity[another_entity_attributes][][attribute_1]" value="1st first" /> <input name="entity[another_entity_attributes][][attribute_1]" value="2nd first" /> <input name="entity[another_entity_attributes][][attribute_2]" value="2nd second" /> *becomes* { entity: { another_entity_attributes: [ { attribute_1: '1st first', attribute_2: '2nd second', }, { attribute_1: '2nd first' } ] } }
About
jQuery helper for serializing Rails forms params style to JSON
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published