Skip to content

About

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

Resources

Code of conduct

Contributing

Stars

18 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

Repository files navigation

๐Ÿ 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.

About

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

Resources

Code of conduct

Contributing

Stars

18 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages