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

    Function FormSubmissionAttemptContextProvider

    • Optional context that lets a host (for example Approvals) trigger the rendered form’s submit-preparation path without duplicating it.

      Wrap both the form and the host action (Approve) so they share one registry. OneBlinkFormBase registers when editableFormElementIds is set. If nothing is registered, useFormSubmissionAttempt still resolves with a no-op FormSubmissionAttemptAllowNavigation so hosts without an editable form are unchanged.

      import {
        FormSubmissionAttemptContextProvider,
        OneBlinkReadOnlyForm,
        useFormSubmissionAttempt,
      } from '@oneblink/apps-react'
      
      function ApproveButton() {
        const attemptFormSubmission = useFormSubmissionAttempt()
      
        const onClickApprove = async () => {
          const allowNavigation = await attemptFormSubmission()
          if (!allowNavigation) {
            return
          }
          // continue with the host action, then:
          allowNavigation()
        }
      
        return 
      }
      
      function Approval() {
        return (
          
            
            
          
        )
      }
      

      Parameters

      • props: { children: ReactNode }
        • children: ReactNode

          The form and the host action that must share one submission attempt.

      Returns Element