onFirstChange

Specification

A callback function dispatched once when the first value change of a field happens.

Parameters

Param
Type
Description
event
Event
Change event reference.
prevValue
any
Previous value of the changed field.
nextValue
any
Next value of the changed field.
fieldProps
Object
Props of the field that triggered the change.
fields
Object
Reference to all fields in the form.
form
Object
Form component reference.

Example

1
import React from 'react'
2
import { Form } from 'react-advanced-form'
3
4
export default class Example extends React.Component {
5
handleFirstChange = ({ event, prevValue, nextValue, fieldProps, fields, form }) => {
6
console.log('Field `%s` made the form dirty.', fieldProps.name)
7
}
8
9
render() {
10
return (
11
<Form onFirstChange={this.handleFirstChange}>
12
{/* Fields here */}
13
</Form>
14
)
15
}
16
}
Copied!
Last modified 3yr ago