paper-button with type="submit" within form doesn't submit?

adarshaj picture adarshaj · Jul 21, 2014 · Viewed 8.4k times · Source

I am trying to use paper-button with type attribute set to submit (as one would do with button element) to submit the enclosing form, but for some reason it is unable to submit the form. Is this a bug or feature?

How to make paper-button submit the form?

PS: I am in dart land (not js).

Answer

just-boris picture just-boris · Nov 16, 2014

As noticed by Gunter, you can create a custom element which extends some of native element with your desired semantics.

I encountered with your issue too and I've created simple element which gives ability to submit to paper-button

<polymer-element name="paper-button-submit" extends="button" noscript>
  <template>
    <style>
      :host {
        border: 0;
        background: transparent;
        padding: 0;
        font-size: inherit;
      }
    </style>
    <paper-button>
      <content></content>
    </paper-button>
  </template>
</polymer-element>

Then you can write this

<button type="submit" is="paper-button-submit">Add</button>

And will get a button with paper-like look