Skip to content

Commit 9029768

Browse files
authored
Merge pull request #122 from workfloworchestrator/1954-get-value-in-field
1954 Trigger validaton on default values
2 parents a078ecf + 86d702c commit 9029768

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': patch
3+
---
4+
5+
Triggers form validation on default values

frontend/packages/pydantic-forms/src/components/render/RenderForm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Here we define the outline of the form
77
*/
8-
import React from 'react';
8+
import React, { useEffect } from 'react';
99

1010
import { useTranslations } from 'next-intl';
1111

@@ -26,9 +26,14 @@ const RenderForm = (contextProps: PydanticFormContextProps) => {
2626
isSending,
2727
skipSuccessNotice,
2828
loadingComponent,
29+
rhf,
2930
} = contextProps;
3031
const { formRenderer, footerRenderer, headerRenderer } = config || {};
3132

33+
useEffect(() => {
34+
rhf.trigger();
35+
}, [rhf, pydanticFormSchema]);
36+
3237
const pydanticFormComponents: PydanticFormComponents =
3338
getPydanticFormComponents(
3439
pydanticFormSchema?.properties || {},

0 commit comments

Comments
 (0)