PolymerElements/iron-form

Name: iron-form

Owner: PolymerElements

Description: Custom form element

Created: 2015-05-13 01:01:02.0

Updated: 2018-04-19 16:39:40.0

Pushed: 2018-05-23 02:28:47.0

Homepage: https://www.webcomponents.org/element/PolymerElements/iron-form

Size: 336

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build status Published on webcomponents.org

Demo and API docs

<iron-form>

<iron-form> is a wrapper around the HTML <form> element, that can validate and submit both custom and native HTML elements.

It has two modes: if allow-redirect is true, then after the form submission you will be redirected to the server response. Otherwise, if it is false, it will use an iron-ajax element to submit the form contents to the server.

Example:

<iron-form>
  <form method="get" action="/form/handler">
    <input type="text" name="name" value="Batman">
    <input type="checkbox" name="donuts" checked> I like donuts<br>
    <paper-checkbox name="cheese" value="yes" checked></paper-checkbox>
  </form>
</iron-form>

By default, a native <button> element (or input type="submit") will submit this form. However, if you want to submit it from a custom element's click handler, you need to explicitly call the iron-form's submit method.

Example:

<paper-button raised onclick="submitForm()">Submit</paper-button>

function submitForm() {
  document.getElementById('iron-form').submit();
}
Changes in 2.0

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.