From 583e996d8c36814f312a3671aa6690e632c54536 Mon Sep 17 00:00:00 2001 From: Faran Javed Date: Thu, 1 May 2025 17:19:07 +0500 Subject: [PATCH] [Feat]: #1537 Add Custom Error Message for Invalid Form --- .../lowcoder/src/comps/comps/formComp/formComp.tsx | 8 ++++++-- client/packages/lowcoder/src/i18n/locales/en.ts | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx b/client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx index 1d2ac87bbc..7ee8106b33 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 d1eff10d73..6a5b77f7ba 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", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy