@@ -13,24 +13,12 @@ import { EuiButton, EuiHorizontalRule } from '@elastic/eui';
1313import { useOrchestratorTheme } from '@/hooks' ;
1414
1515export const Footer = ( ) => {
16- const {
17- rhf,
18- onCancel,
19- onPrevious,
20- allowUntouchedSubmit,
21- hasNext,
22- formInputData,
23- } = usePydanticFormContext ( ) ;
16+ const { onCancel, onPrevious, hasNext, formInputData } =
17+ usePydanticFormContext ( ) ;
2418
2519 const { theme } = useOrchestratorTheme ( ) ;
2620 const t = useTranslations ( 'pydanticForms.userInputForm' ) ;
2721
28- const isDisabled : boolean =
29- ! rhf . formState . isValid ||
30- ( ! allowUntouchedSubmit &&
31- ! rhf . formState . isDirty &&
32- ! rhf . formState . isSubmitting ) ;
33-
3422 const handlePrevious = ( ) => {
3523 if ( onCancel ) {
3624 onCancel ( ) ;
@@ -74,6 +62,15 @@ export const Footer = () => {
7462 const SubmitButton = ( ) => {
7563 const submitButtonLabel = hasNext ? t ( 'next' ) : t ( 'startWorkflow' ) ;
7664
65+ /*
66+ * The submit button is used to submit the form data.
67+ * If there is a next step, it will be labeled as "Next".
68+ * If there is no next step, it will be labeled as "Start Workflow".
69+ * The button is styled with primary color and has an icon on the right side.
70+ * We don't use the disable property based on the form valid state here. When calculating the form valid state
71+ * react-hook-form might return a false negative - marking the form invalid - when not all fields have a defaultValue
72+ * which is a valid use case. https://chatgpt.com/c/6874c574-0044-800c-8dda-04c8cc24b0a3
73+ */
7774 return (
7875 < EuiButton
7976 id = "button-submit-form-submit"
@@ -83,7 +80,6 @@ export const Footer = () => {
8380 type = "submit"
8481 iconSide = "right"
8582 aria-label = { submitButtonLabel }
86- disabled = { isDisabled }
8783 >
8884 { submitButtonLabel }
8985 </ EuiButton >
0 commit comments