diff --git a/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx b/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx index 1d2ac87bb..7ee8106b3 100644 --- a/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx +++ b/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx @@ -60,6 +60,7 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances" import { styled } from "styled-components"; import { styleControl } from "@lowcoder-ee/comps/controls/styleControl"; import { AnimationStyle } from "@lowcoder-ee/comps/controls/styleControlConstants"; +import { StringControl } from "comps/controls/codeControl"; const FormWrapper = styled.div` height: 100%; @@ -80,7 +81,8 @@ const childrenMap = { disableSubmit: BoolCodeControl, loading: BoolCodeControl, onEvent: eventHandlerControl(eventOptions), - animationStyle: styleControl(AnimationStyle) + animationStyle: styleControl(AnimationStyle), + invalidFormMessage: StringControl }; type FormProps = TriContainerViewProps & @@ -230,6 +232,7 @@ const FormBaseComp = (function () { {(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{children.initialData.propertyView({ label: trans("formComp.initialData") })} + {children.invalidFormMessage.propertyView({ label: trans("formComp.invalidFormMessage") })}
)} @@ -363,7 +366,8 @@ let FormTmpComp = class extends FormBaseComp implements IForm { return Promise.resolve(); }); } else { - messageInstance.error(trans("formComp.notValidForm")); + const customMessage = this.children.invalidFormMessage.getView(); + messageInstance.error(customMessage || trans("formComp.notValidForm")); return Promise.reject("formComp.notValidForm"); } } diff --git a/client/packages/lowcoder/src/i18n/locales/en.ts b/client/packages/lowcoder/src/i18n/locales/en.ts index d1eff10d7..6a5b77f7b 100644 --- a/client/packages/lowcoder/src/i18n/locales/en.ts +++ b/client/packages/lowcoder/src/i18n/locales/en.ts @@ -2546,6 +2546,7 @@ export const en = { "success": "Form Generated Successfully", "selectCompType": "Select Component Type", "dataSource": "Data Source: ", + "invalidFormMessage": "Custom Invalid Form Message", "selectSource": "Select Source", "table": "Table: ", "selectTable": "Select Table",