Add form validation to NewObjectForm component
- Implemented validation for form fields in the NewObjectForm component. - Added logic to set form validity state based on validation results.
This commit is contained in:
parent
2fbafc5396
commit
b38af41929
@ -141,6 +141,10 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
||||
const computedValuesObject = buildObjectFromEntries(computedEntries)
|
||||
const initialFormData = merge({}, defaultValues, computedValuesObject)
|
||||
form.setFieldsValue(initialFormData)
|
||||
form
|
||||
.validateFields({ validateOnly: true })
|
||||
.then(() => setFormValid(true))
|
||||
.catch(() => setFormValid(false))
|
||||
setObjectData((prev) => merge({}, prev, initialFormData))
|
||||
}
|
||||
}, [form, defaultValues, calculateComputedValues, model])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user