Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 54c82ad

Browse files
Merge pull request #1672 from iamfaran/feat/1537-custom-error-message
[Feat]: #1537 Add Custom Invalid Form Message
2 parents 71fa1f2 + 583e996 commit 54c82ad

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
6060
import { styled } from "styled-components";
6161
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
6262
import { AnimationStyle } from "@lowcoder-ee/comps/controls/styleControlConstants";
63+
import { StringControl } from "comps/controls/codeControl";
6364

6465
const FormWrapper = styled.div`
6566
height: 100%;
@@ -80,7 +81,8 @@ const childrenMap = {
8081
disableSubmit: BoolCodeControl,
8182
loading: BoolCodeControl,
8283
onEvent: eventHandlerControl(eventOptions),
83-
animationStyle: styleControl(AnimationStyle)
84+
animationStyle: styleControl(AnimationStyle),
85+
invalidFormMessage: StringControl
8486
};
8587

8688
type FormProps = TriContainerViewProps &
@@ -230,6 +232,7 @@ const FormBaseComp = (function () {
230232
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
231233
<Section name={sectionNames.advanced}>
232234
{children.initialData.propertyView({ label: trans("formComp.initialData") })}
235+
{children.invalidFormMessage.propertyView({ label: trans("formComp.invalidFormMessage") })}
233236
</Section>
234237
)}
235238

@@ -363,7 +366,8 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
363366
return Promise.resolve();
364367
});
365368
} else {
366-
messageInstance.error(trans("formComp.notValidForm"));
369+
const customMessage = this.children.invalidFormMessage.getView();
370+
messageInstance.error(customMessage || trans("formComp.notValidForm"));
367371
return Promise.reject("formComp.notValidForm");
368372
}
369373
}

‎client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,6 +2547,7 @@ export const en = {
25472547
"success": "Form Generated Successfully",
25482548
"selectCompType": "Select Component Type",
25492549
"dataSource": "Data Source: ",
2550+
"invalidFormMessage": "Custom Invalid Form Message",
25502551
"selectSource": "Select Source",
25512552
"table": "Table: ",
25522553
"selectTable": "Select Table",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /