Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
org.webjars.bowergithub.polymerelements:iron-form
Advanced tools
<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.
See: Documentation, Demo.
npm install --save @polymer/iron-form
<html>
<head>
<script type="module">
import '@polymer/iron-form/iron-form.js';
import '@polymer/paper-checkbox/paper-checkbox.js';
</script>
</head>
<body>
<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>
</body>
</html>
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:
<paper-button raised onclick="submitForm()">Submit</paper-button>
function submitForm() {
document.getElementById('iron-form').submit();
}
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-form/iron-form.js';
import '@polymer/paper-checkbox/paper-checkbox.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<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>
`;
}
}
customElements.define('sample-element', SampleElement);
If you want to send a PR to this element, here are the instructions for running the tests and demo locally:
git clone https://github.com/PolymerElements/iron-form
cd iron-form
npm install
npm install -g polymer-cli
polymer serve --npm
open http://127.0.0.1:<port>/demo/
polymer test --npm
FAQs
WebJar for iron-form
We found that org.webjars.bowergithub.polymerelements:iron-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.