v14.2.0

Playroom

Github

Form

View Source

Copy
Edit

:

Copy
Edit

Props

initialPayloadObject

The initial data to seed the form with. Used to determine previous state when a cancel action occurs as well as if the form should submit or not. This can be passed new data (like updating from onSubmit). Use a simple data structure to avoid false positives when the previous and initial payload are compared to determine calling onSubmit.

onSubmit(payload: Object<any>, complete: () => void) => void

Called whenever a submit action occurs (enter key / form blur) and the form has a different internal payload compared to the initialPayload.

payload

The newly edited payload that should be submitted.

complete

Call whenever the form is done completing to re-enable the form.

children(props: { isEditing: boolean, isSubmitting: boolean, editButtonProps: Object, getFieldProps: (id: any) => Object, }) => React.Node

isEditing

Toggled by trigger or focusing/blurring a field.

isSubmitting

True when a submit action occurs either from the enter key or blurring the form with different data from initialPayload.

editButtonProps

Provides the proper props and callbacks to toggle editing mode and show a spinner when submitting. Must be passed to a Button component.

getFieldProps

Accepts an id as the first argument that maps to the respective field key in initialPayload. It also receives a getChangeValue function as the second argument used to resolve the value when dealing with non traditional events like Select or NumberField.

  • Props
PreviousFieldSetNextInput