mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +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'
|
type='reset'
|
||||||
color='warning'
|
color='warning'
|
||||||
className='px-4'
|
className='px-4'
|
||||||
onClick={formik.handleReset}
|
onClick={() => {
|
||||||
|
formik.handleReset();
|
||||||
|
formik.validateForm();
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
@@ -73,7 +76,12 @@ export const FormActions = <T,>({
|
|||||||
color='primary'
|
color='primary'
|
||||||
className='px-4'
|
className='px-4'
|
||||||
isLoading={formik.isSubmitting}
|
isLoading={formik.isSubmitting}
|
||||||
disabled={disableSubmit || !formik.isValid || formik.isSubmitting}
|
disabled={
|
||||||
|
disableSubmit ||
|
||||||
|
!formik.isValid ||
|
||||||
|
!formik.dirty ||
|
||||||
|
formik.isSubmitting
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
|||||||
type === 'edit' ? UpdateMovementFormSchema : MovementFormSchema,
|
type === 'edit' ? UpdateMovementFormSchema : MovementFormSchema,
|
||||||
validateOnChange: true,
|
validateOnChange: true,
|
||||||
validateOnBlur: true,
|
validateOnBlur: true,
|
||||||
|
validateOnMount: true,
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
setMovementFormErrorMessage('');
|
setMovementFormErrorMessage('');
|
||||||
const payload: CreateMovementPayload = {
|
const payload: CreateMovementPayload = {
|
||||||
|
|||||||
Reference in New Issue
Block a user