iron-form icon indicating copy to clipboard operation
iron-form copied to clipboard

[feature request] form elements

Open vdegenne opened this issue 6 years ago • 0 comments

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>

vdegenne avatar May 29 '18 10:05 vdegenne