# form-controls

> A cross-browser helper for retrieving all controls in a form

Latest version **1.0.0** (published 2015-11-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install form-controls
pnpm add form-controls
yarn add form-controls
bun add form-controls
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-11-14 |
| First published | 2015-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dominic Barnes |
| Maintainers | dominicbarnes |
| Keywords | browser, controls, form |

## Links

- npm: https://www.npmjs.com/package/form-controls
- Repository: https://github.com/dominicbarnes/form-controls
- Homepage: https://github.com/dominicbarnes/form-controls#readme
- Issues: https://github.com/dominicbarnes/form-controls/issues
- npm.io page: https://npm.io/package/form-controls

## Dependencies (1)

- [to-array](https://npm.io/package/to-array.md) ^0.1.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-11-14

## README

# form-controls

[![npm version](https://img.shields.io/npm/v/form-controls.svg)](https://www.npmjs.com/package/form-controls)
[![npm dependencies](https://img.shields.io/david/dominicbarnes/form-controls.svg)](https://david-dm.org/dominicbarnes/form-controls)
[![npm dev dependencies](https://img.shields.io/david/dev/dominicbarnes/form-controls.svg)](https://david-dm.org/dominicbarnes/form-controls#info=devDependencies)
[![build status](https://img.shields.io/travis/dominicbarnes/form-controls.svg)](https://travis-ci.org/dominicbarnes/form-controls)

A helper for retrieving all of the controls for a given root element.

## Usage

```html
<form id="my-form">
    <input type="hidden" name="id" value="123456">
    <input type="text" name="username" value="dominicbarnes">
    <input type="url" name="website" value="http://dbarnes.info/">
</form>
```

```js
var controls = require('form-controls');
var el = document.querySelector('#my-form');

controls(el);
// => [
//     <input type="hidden" name="id" value="123456">,
//     <input type="text" name="username" value="dominicbarnes">,
//     <input type="url" name="website" value="http://dbarnes.info/">
// ]
```


## API

### controls(root)

Returns an `Array` of `HTMLElement` that represent the
[listed controls](http://www.w3.org/TR/html5/forms.html#category-listed)
for the `root` element.

It is *recommended* that you use either a `<form>` or `<fieldset>` as the `root`,
as there is already a DOM API for this operation. However, other arbitrary elements
are supported, mostly because I needed a "brute-force" fallback for when IE doesn't
work anyways.

---
_Source: https://npm.io/package/form-controls · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
