Function useFormSubmissionAutoSaveState
use Form Submission Auto Save State ( options ) : { continueAutoSaveSubmission : ( ( ) => void ) ; definition : Form ; executedLookups : ExecutedLookups ; handleCancel : ( ( ) => void ) ; handleNavigateAway : ( ( ) => void ) ; handleSaveDraft : undefined | ( ( newDraftSubmission ) => void ) ; handleSubmit : ( ( submissionResult ) => void ) ; isAutoSaveSubmissionAvailable : boolean ; isLoadingAutoSaveSubmission : boolean ; lastElementUpdated : undefined | FormElement ; setFormSubmission : Dispatch < SetStateAction < { definition : Form ; executedLookups : ExecutedLookups ; lastElementUpdated : undefined | FormElement ; submission : { [name : string ]: unknown ; } ; } > > ; startNewSubmission : ( ( ) => void ) ; submission : { [name : string ]: unknown ; } ; }
Parameters
options : { autoSaveKey : string ; form : Form ; initialSubmission ?: { [name : string ]: unknown ; } ; onCancel : ( ( ) => unknown ) ; onSaveDraft ?: ( ( newDraftSubmission ) => unknown ) ; onSubmit : ( ( newFormSubmission ) => unknown ) ; removeAutoSaveDataBeforeSaveDraft ?: boolean ; removeAutoSaveDataBeforeSubmit ?: boolean ; resumeAtElement ?: FormElement ; }
auto Save Key : string
Optional
initial Submission ?: { [name : string ]: unknown ; }
on Cancel : ( ( ) => unknown )
( ) : unknown
Returns unknown
Optional
on Save Draft ?: ( ( newDraftSubmission ) => unknown )
( newDraftSubmission ) : unknown
Parameters
newDraftSubmission : NewDraftSubmission
Returns unknown
on Submit : ( ( newFormSubmission ) => unknown )
( newFormSubmission ) : unknown
Parameters
newFormSubmission : NewFormSubmission
Returns unknown
Optional
remove Auto Save Data Before Save Draft ?: boolean
Optional
remove Auto Save Data Before Submit ?: boolean
Optional
resume At Element ?: FormElement
Returns { continueAutoSaveSubmission : ( ( ) => void ) ; definition : Form ; executedLookups : ExecutedLookups ; handleCancel : ( ( ) => void ) ; handleNavigateAway : ( ( ) => void ) ; handleSaveDraft : undefined | ( ( newDraftSubmission ) => void ) ; handleSubmit : ( ( submissionResult ) => void ) ; isAutoSaveSubmissionAvailable : boolean ; isLoadingAutoSaveSubmission : boolean ; lastElementUpdated : undefined | FormElement ; setFormSubmission : Dispatch < SetStateAction < { definition : Form ; executedLookups : ExecutedLookups ; lastElementUpdated : undefined | FormElement ; submission : { [name : string ]: unknown ; } ; } > > ; startNewSubmission : ( ( ) => void ) ; submission : { [name : string ]: unknown ; } ; }
continue Auto Save Submission : ( ( ) => void )
definition : Form
handle Cancel : ( ( ) => void )
handle Navigate Away : ( ( ) => void )
handle Save Draft : undefined | ( ( newDraftSubmission ) => void )
handle Submit : ( ( submissionResult ) => void )
( submissionResult ) : void
Parameters
submissionResult : NewFormSubmission
Returns void
is Auto Save Submission Available : boolean
is Loading Auto Save Submission : boolean
last Element Updated : undefined | FormElement
set Form Submission : Dispatch < SetStateAction < { definition : Form ; executedLookups : ExecutedLookups ; lastElementUpdated : undefined | FormElement ; submission : { [name : string ]: unknown ; } ; } > >
start New Submission : ( ( ) => void )
submission : { [name : string ]: unknown ; }
Use this if you want to implement a controlled auto saving form. See OneBlinkFormControlled for a full example. If you do not need to control the
submission
ordefinition
properties, you can use the OneBlinkAutoSaveForm component.