Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@polymer/iron-form
Advanced tools
Wrapper around native form that submits native and custom elements
<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
Wrapper around native form that submits native and custom elements
We found that @polymer/iron-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.