Skip to content

n-form validation status reactive #2675

Closed
@AlexZCP

Description

@AlexZCP

This function solves the problem (这个功能解决的问题)

Validation status of whole form that can be used for disabling submit buttons, etc

Expected API (期望的 API)

Currently n-form-item has a validationErrored reactive field to check if it passed validation or not.
It would be great to have analogical field for whole form.

However, if there is an alternative way to make disabled submit button whole it's not valid, point me please.

Concept example:

    <n-form ref="formRef" :model="model" :rules="rules">
      <n-form-item label="Label A" path="fieldA">
        <n-input v-model:value="model.fieldA" />
      </n-form-item>
      <n-form-item label="Label B" path="fieldB">
        <n-input v-model:value="model.fieldB" />
      </n-form-item>
     <n-button :disabled="formRef.validationErrored">Submit</n-button>
    </n-form>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions