Adds functionality to handle form element serialization. serialize() and serializeArray() mimic their jQuery counterparts in terms of output. As the { name, value } format is less useful for most Python applications, this PR introduces formats compatible with, e.g., the Requests library:
Adds functionality to handle form element serialization.
serialize()
andserializeArray()
mimic their jQuery counterparts in terms of output. As the{ name, value }
format is less useful for most Python applications, this PR introduces formats compatible with, e.g., the Requests library:serializePairs()
=>[('order', 'spam'), ('order', 'eggs'), ('order2', 'ham')]
serializeDict()
=>OrderedDict([('order', ['spam', 'eggs']), ('order2', 'ham')])
I have added documentation and passing tests (whose results agree with jQuery 3.3.1).
Note that this includes a minor fix for the
root()
method, and strips newlines when querying the value of non-radio, non-checkboxinput
elements.