This feature is experimental. It may be changed or removed in a future version without prior notice or deprecation.
Constructs a new
up.Params instance from the given
up.Params will include exactly those form values that would be
included in a regular form submission. In particular:
<input>types are suppported
<input type="file">will produce
<input type="checkbox">will only be added if they are
<select>will only be added if at least one value is
<input type="file" multiple>, all selected values are added. If passed a
<select multiple>, all selected values are added.
[name]attribute are ignored.
Given this HTML form:
<form> <input type="text" name="email" value="firstname.lastname@example.org"> <input type="password" name="pass" value="secret"> </form>
This would serialize the form into an array representation:
var params = up.Params.fromForm('input[name=email]') var email = params.get('email') // email is now 'email@example.com' var pass = params.get('pass') // pass is now 'secret'
up.Params instance with values from the given form.