Skip to content

Commit

Permalink
validations done for assumptions and formula (#1906)
Browse files Browse the repository at this point in the history
Co-authored-by: Nipun Arora <[email protected]>
  • Loading branch information
Swathi-eGov and nipunarora-eGov authored Nov 27, 2024
1 parent 7f2cf05 commit 24540b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ const FormulaConfiguration = ({ onSelect, category, customProps, formulas: initi
return;
}

if (!(selectedDeletedFormula?.name && /^[a-zA-Z0-9]*$/.test(selectedDeletedFormula?.name))) {
if (!(selectedDeletedFormula?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+$/.test(selectedDeletedFormula?.name))) {
setShowToast({
key: "error",
label: t("MP_FORMULA_NAME_INVALID") ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,20 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
});
return;
}

//alphanumeric name of assumption
if (!(selectedDeletedAssumption?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+$/.test(selectedDeletedAssumption?.name))) {
setShowToast({
key: "error",
label: t("MP_ASSUMPTION_NAME_INVALID") ,
transitionTime: 3000,
style: {
zIndex: 1000000
}
});
return
}

//If no issues then go ahead and add assumption
addNewAssumption();
}}
Expand Down

0 comments on commit 24540b1

Please sign in to comment.