fix: text input validation issue if user not select any validation or free user also

This commit is contained in:
RaktimaNXG
2024-04-18 17:20:44 +05:30
parent 5cecf3390b
commit cb6d9e9b9b
4 changed files with 26 additions and 23 deletions
@@ -40,7 +40,7 @@ function PlaceholderType(props) {
const validateExpression = (regexValidation) => {
if (textValue) {
let regexObject = regexValidation;
if (props.pos?.options.validation.type === "regex") {
if (props.pos?.options?.validation?.type === "regex") {
regexObject = RegexParser(regexValidation);
}
// new RegExp(regexValidation);
@@ -89,11 +89,11 @@ function PlaceholderType(props) {
case "number":
setValidatePlaceholder("12345");
break;
case textInputWidget:
setValidatePlaceholder("enter text");
case "text":
setValidatePlaceholder("please enter text");
break;
default:
setValidatePlaceholder("enter text");
setValidatePlaceholder("please enter value");
}
}
@@ -407,7 +407,7 @@ function PlaceholderType(props) {
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<textarea
ref={inputRef}
placeholder={validatePlaceholder}
placeholder={validatePlaceholder || "please enter value"}
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
@@ -710,7 +710,7 @@ function PlaceholderType(props) {
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<textarea
ref={inputRef}
placeholder={"email"}
placeholder={"enter email"}
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
@@ -782,7 +782,7 @@ function PlaceholderType(props) {
case textWidget:
return (
<textarea
placeholder="Enter label"
placeholder="Enter text"
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
@@ -13,7 +13,7 @@ const WidgetNameModal = (props) => {
defaultValue: "",
status: "required",
hint: "",
textvalidate: "text"
textvalidate: ""
});
const [isValid, setIsValid] = useState(true);
const statusArr = ["Required", "Optional"];
@@ -48,7 +48,7 @@ const WidgetNameModal = (props) => {
defaultValue: "",
status: "required",
hint: "",
textvalidate: "text"
textvalidate: ""
});
}
};
@@ -82,7 +82,7 @@ const WidgetNameModal = (props) => {
function handleBlurRegex() {
if (!formdata.textvalidate) {
setFormdata({ ...formdata, textvalidate: "text" });
setFormdata({ ...formdata, textvalidate: "" });
} else {
if (formdata.defaultValue) {
const regexObject = RegexParser(
+4 -4
View File
@@ -323,15 +323,15 @@ export const addWidgetOptions = (type) => {
options: { isReadOnly: false, isHideLabel: false }
};
case textInputWidget:
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
return { ...defaultOpt };
case "initials":
return defaultOpt;
case "name":
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
return { ...defaultOpt };
case "company":
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
return { ...defaultOpt };
case "job title":
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
return { ...defaultOpt };
case "date":
return {
...defaultOpt,
+12 -9
View File
@@ -1375,10 +1375,7 @@ function PlaceHolderSign() {
inputype = options.includes(defaultdata.textvalidate)
? defaultdata.textvalidate
: "regex";
} else {
inputype = "text";
}
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
if (filterSignerPos.length > 0) {
const getPlaceHolder = filterSignerPos[0].placeHolder;
@@ -1401,11 +1398,14 @@ function PlaceHolderSign() {
status: defaultdata?.status || "required",
hint: defaultdata?.hint || "",
defaultValue: defaultdata?.defaultValue || "",
validation: {
type: inputype,
pattern:
inputype === "regex" ? defaultdata.textvalidate : ""
}
validation:
(isSubscribe || !isEnableSubscription) && inputype
? {
type: inputype,
pattern:
inputype === "regex" ? defaultdata.textvalidate : ""
}
: {}
}
};
} else {
@@ -1695,7 +1695,10 @@ function PlaceHolderSign() {
style={{ padding: 20 }}
>
{isSendAlert.mssg === "sure" ? (
<span>Please add at least one signature field for all recipients.</span>
<span>
Please add at least one signature field for all
recipients.
</span>
) : isSendAlert.mssg === textWidget ? (
<p>Please confirm that you have filled the text field.</p>
) : (