Hex Core JS
    Preparing search index...

    Function useConditionalField

    • Handles cleanup of conditionally rendered fields.

      When the condition is false, for the given name or names, clears the corresponding field value, sets the validation status to "Success", clears any validation errors, and clears the id of the field in the form state. This allows for form submission without passing validation on the conditionally rendered field(s).

      For handling validation of form fields that are not rendered, see useInternalField, which does not alter field values.

      Type Parameters

      Parameters

      • condition: boolean

        The condition to check.

      • formState: UseConditionalFieldPartialFormState<FV>

        The state of the form.

      • name: keyof FV | (keyof FV)[]

        A field name or array of field names that are conditionally rendered.

      Returns void