@oneblink/apps-react
    Preparing search index...

    Function useFormSubmissionAutoSaveState

    • 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 or definition properties, you can use the OneBlinkAutoSaveForm component.

      Parameters

      • options: {
            autoSaveKey: string;
            form: Form;
            formIsDisabled?: boolean;
            initialSubmission?: { [name: string]: unknown };
            onCancel: () => unknown;
            onSaveDraft?: (newDraftSubmission: NewDraftSubmission) => unknown;
            onSubmit: (newFormSubmission: NewFormSubmission) => unknown;
            removeAutoSaveDataBeforeSaveDraft?: boolean;
            removeAutoSaveDataBeforeSubmit?: boolean;
            resumeAtElement?: FormElement;
            resumePreviousElapsedDurationSeconds?: number;
            resumeSectionState?: { id: string; state: "COLLAPSED" | "EXPANDED" }[];
        }

      Returns {
          continueAutoSaveSubmission: () => void;
          definition: Form;
          executedLookups: ExecutedLookups;
          getCurrentSubmissionDuration: () => number;
          handleCancel: () => void;
          handleNavigateAway: () => void;
          handleSaveDraft:
              | ((newDraftSubmission: NewDraftSubmission) => void)
              | undefined;
          handleSubmit: (submissionResult: NewFormSubmission) => void;
          isAutoSaveSubmissionAvailable: boolean;
          isLoadingAutoSaveSubmission: boolean;
          lastElementUpdated: FormElement | undefined;
          sectionState: { id: string; state: "COLLAPSED" | "EXPANDED" }[] | undefined;
          setFormSubmission: Dispatch<
              SetStateAction<
                  {
                      definition: Form;
                      executedLookups: ExecutedLookups;
                      lastElementUpdated: FormElement
                      | undefined;
                      sectionState:
                          | { id: string; state: "COLLAPSED"
                          | "EXPANDED" }[]
                          | undefined;
                      submission: { [name: string]: unknown };
                  },
              >,
          >;
          startNewSubmission: () => void;
          submission: { [name: string]: unknown };
      }