# @falsy/forms

> ## How To Use It

Latest version **0.1.6** (published 2017-05-06) · 0 weekly downloads

## Install

```sh
npm install @falsy/forms
pnpm add @falsy/forms
yarn add @falsy/forms
bun add @falsy/forms
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2017-05-06 |
| First published | 2017-04-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | smidhonza |

## Links

- npm: https://www.npmjs.com/package/@falsy/forms
- npm.io page: https://npm.io/package/@falsy/forms

## Dependencies (2)

- [react](https://npm.io/package/react.md) 15.5.4
- [prop-types](https://npm.io/package/prop-types.md) 15.5.8

## Recent versions

- 0.1.6 (latest) — 2017-05-06
- 0.1.5 — 2017-04-29
- 0.1.4 — 2017-04-29
- 0.1.3 — 2017-04-29
- 0.1.2 — 2017-04-29
- 0.1.1 — 2017-04-29
- 0.1.0 — 2017-04-29

## README

# Forms

## How To Use It

```jsx
import { Form } from 'forms';

<Form
	id="formId"
	fields={fields}
	onSubmit={onSubmit}
/>  
```


## Validation rules

### required

```json
{
  "type": "required",
  "rules": [
    {
      "message": "This field is required."
    }
  ]
}
```

### mustbeequal
```json
{
  "type": "mustbeequal",
  "rules": [
    {
      "value": true,
      "message": "You need to agree to the terms and conditions"
    }
  ]
}
```

### inlist
```json
{
  "type": "inlist",
  "rules": [
    {
      "value": ["Mr", "Mrs", "Ms", "Miss", "Dr", "Rev", "Prof"],
      "message": "Title was not a valid choice"
    }
  ]
}
```
### maxlength
```json
{
  "type": "maxlength",
  "rules": [
    {
      "value": 32,
      "message": "Your username can only have 3 - 32 characters"
    }
  ]
}
```

### minlength
```json
{
  "type": "minlength",
  "rules": [
    {
      "value": 3,
      "message": "Your username can only have 3 - 32 characters"
    }
  ]
}
```
### pattern
```json
{
  "type": "pattern",
  "rules": [
    {
      "value": "^[a-zA-Z]+",
      "message": "Your username can only start with a letter"
    },
    {
      "value": "^[a-zA-Z0-9\\-\\._]+[a-zA-Z0-9]$",
      "message": "Your username can only contain letters and numbers"
    }
  ]
}
```
### notpattern
```json
{
  "type": "notpattern",
  "rules": [
    {
      "value": "[\\-\\.\\_][\\-\\.\\_]",
      "message": "Your username can only contain letters and numbers"
    }
  ]
}
```

### mustmatch
```json
{
  "type": "mustmatch",
  "rules": [
    {
      "value": "password",
      "message": "The passwords you entered didn't match. Please try again"
    }
  ]
}
```
### mustmatchcaseinsensitive
```json
{
  "type": "mustmatchcaseinsensitive",
  "rules": [
    {
      "value": "email",
      "message": "Sorry, your email addresses do not match. Please try again"
    }
  ]
}
```

## Publishing

make sure you have everything pushed and run

`npm version patch` (major | minor | patch)

and then `npm publish`


don't forget to push everything

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