A native form element provides the elements property which contains a list of all the elements in the form (input, select, ...). However one would expect to use paper-input or other web-components that Polymer provides. elements of a native form element ignores tags that it doesn't know so for instance, this :
<iron-form>
<form id="myForm">
<paper-input name="firstname" label="firstname"></paper-input>
<paper-input name="lastname" label="lastname"></paper-input>
<input type="hidden" name="id" value="1">
</form>
</iron-form>
<script>
console.log(window.myForm.elements); // only contains the native hidden type input (id)
</script>
That'd be great if one could do :
<iron-form id="mySuperForm">
<form>
<paper-input name="firstname" label="firstname"></paper-input>
<paper-input name="lastname" label="lastname"></paper-input>
<input type="hidden" name="id" value="1">
</form>
</iron-form>
<script>
console.log(window.mySuperForm.elements); // returns all the three elements (firstname, lastname, id)
</script>
A native
form
element provides theelements
property which contains a list of all the elements in the form (input
,select
, ...). However one would expect to usepaper-input
or other web-components that Polymer provides.elements
of a nativeform
element ignores tags that it doesn't know so for instance, this :That'd be great if one could do :