Mutator for setting a field as "touched" in ๐Ÿ Final Form
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commitโ€ฆ
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github First commit Jan 11, 2018
src
.babelrc First commit Jan 11, 2018
.eslintignore
.eslintrc
.flowconfig
.gitignore
.prettierrc
.travis.yml First commit Jan 11, 2018
LICENSE First commit Jan 11, 2018
README.md
package-lock.json First commit Jan 11, 2018
package-scripts.js First commit Jan 11, 2018
package.json
rollup.config.js First commit Jan 11, 2018

README.md

๐Ÿ Final Form Set Field Touched

NPM Version NPM Downloads Build Status codecov.io styled with prettier

Mutator for setting a field as "touched" in ๐Ÿ Final Form.


Installation

npm install --save final-form-set-field-touched

or

yarn add final-form-set-field-touched

Usage

import { createForm } from 'final-form'
import setFieldTouched from 'final-form-set-field-touched'

// Create Form
const form = createForm({
  mutators: { setFieldTouched },
  onSubmit
})

form.mutators.setFieldTouched('firstName', true)

form.registerField(
  'firstName',
  fieldState => {
    const { touched } = fieldState // true
  },
  {
    // ...other subscription items
    touched: true
  }
)

Mutator

form.mutators.setFieldTouched(name: string, touched: boolean) => void

Sets the specified field's touched flag to the boolean value provided.