# self-validating-text-field

> Self validating text field

Latest version **1.0.9** (published 2018-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install self-validating-text-field
pnpm add self-validating-text-field
yarn add self-validating-text-field
bun add self-validating-text-field
```

## 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.9 |
| Published | 2018-12-20 |
| First published | 2018-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jumper |
| Maintainers | neroze |

## Links

- npm: https://www.npmjs.com/package/self-validating-text-field
- Repository: https://github.com/neroze/self-validating-text-field
- Homepage: https://github.com/neroze/self-validating-text-field/edit/master/README.md
- Issues: https://github.com/neroze/self-validating-text-field/issues
- npm.io page: https://npm.io/package/self-validating-text-field

## Dependencies (1)

- [simple-react-validator](https://npm.io/package/simple-react-validator.md) ^1.0.1

## Recent versions

- 1.0.9 (latest) — 2018-12-20
- 1.0.8 — 2018-12-20
- 1.0.7 — 2018-12-20
- 1.0.6 — 2018-12-20
- 1.0.5 — 2018-12-20
- 1.0.4 — 2018-05-11
- 1.0.3 — 2018-05-11
- 1.0.2 — 2018-05-11
- 1.0.1 — 2018-05-11
- 1.0.0 — 2018-05-11

## README

# self-validating-text-field
Self Validating test field

```
import React, { Fragment } from "react";
import InputField from "self-validating-text-field";
import SimpleReactValidator from "simple-react-validator";

export default class extends React.Component {
  state = {
    email: "neerooz@gmail.com"
  };

  componentDidMount = () => {
    const validator = new SimpleReactValidator();
    this.setState({ validator });
  };

  submit = () => {
    if (this.validator.allValid()) {
      alert("You submitted the form and stuff!");
    } else {
      this.validator.showMessages();
      // rerender to show messages for the first time
      this.forceUpdate();
    }
  };

  render() {
    console.log("this.Validator", this.state.validator);
    return (
      <Fragment>
        {this.state.validator && (
          <InputField
            name="name"
            validator={this.state.validator}
            placeholder={"Name"}
            onChange={e => {
              const { value } = e.target;
              console.log("----------->", value);
            }}
            rules={"required|email"}
            value={this.state.email}
          />
        )}

        <button onClick={this.submit}>Submit</button>
      </Fragment>
    );
  }
}

```

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