npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seemple-parse-form

v2.4.17

Published

Binds named fields of HTML5 form

Downloads

17

Readme

seemple-parse-form npm version

The function binds named HTML form fields (input, select, textarea etc) contained at given HTML form to corresponding properties.

<form class="my-form">
    <input type="text" value="foo" name="x">
</form>
const object = {};
parseForm(object, '.my-form');

// ...
console.log(object.x); // 'foo'
object.x = 'bar'; // changes input value to 'bar'

Usage

In browser environment (or whatever environment where Seemple is global variable) Seemple is extended.

<script src="path/to/seemple-parse-form.min.js"></script>
Seemple.parseForm(object, form);

The bundle can be downloaded at gh-pages branch


In CJS environment Seemple is not extended.

npm install seemple-parse-form
const parseForm = require('seemple-parse-form');

API

The function accepts 4 arguments:

  • object - an object (required)
  • form - a selector, DOM node etc. of given form (custom selectors :sandbox and :bound(XXX) also acceptable) (required)
  • callback - a function which will be called on every found field; accepts field name and field element itself
  • eventOptions - event options which will be passed to every internal call of bindNode.

Returns: parsed form element.

The third argument is useful when parseForm is used with Seemple.Object: you can call addDataKeys method there.

const form = parseForm(this, ':sandbox .foo', key => this.addDataKeys(key), {
    getValueOnBind: false
});