mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
feat(FE-62,65): enhance MovementForm and FormActions to improve form validation and reset behavior
This commit is contained in:
@@ -64,7 +64,10 @@ export const FormActions = <T,>({
|
||||
type='reset'
|
||||
color='warning'
|
||||
className='px-4'
|
||||
onClick={formik.handleReset}
|
||||
onClick={() => {
|
||||
formik.handleReset();
|
||||
formik.validateForm();
|
||||
}}
|
||||
>
|
||||
Reset
|
||||
</Button>
|
||||
@@ -73,7 +76,12 @@ export const FormActions = <T,>({
|
||||
color='primary'
|
||||
className='px-4'
|
||||
isLoading={formik.isSubmitting}
|
||||
disabled={disableSubmit || !formik.isValid || formik.isSubmitting}
|
||||
disabled={
|
||||
disableSubmit ||
|
||||
!formik.isValid ||
|
||||
!formik.dirty ||
|
||||
formik.isSubmitting
|
||||
}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
|
||||
@@ -64,6 +64,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
type === 'edit' ? UpdateMovementFormSchema : MovementFormSchema,
|
||||
validateOnChange: true,
|
||||
validateOnBlur: true,
|
||||
validateOnMount: true,
|
||||
onSubmit: async (values) => {
|
||||
setMovementFormErrorMessage('');
|
||||
const payload: CreateMovementPayload = {
|
||||
|
||||
Reference in New Issue
Block a user