Skip to content

Commit cb6d9e9

Browse files
fix: text input validation issue if user not select any validation or free user also
1 parent 5cecf33 commit cb6d9e9

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

apps/OpenSign/src/components/pdf/PlaceholderType.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function PlaceholderType(props) {
4040
const validateExpression = (regexValidation) => {
4141
if (textValue) {
4242
let regexObject = regexValidation;
43-
if (props.pos?.options.validation.type === "regex") {
43+
if (props.pos?.options?.validation?.type === "regex") {
4444
regexObject = RegexParser(regexValidation);
4545
}
4646
// new RegExp(regexValidation);
@@ -89,11 +89,11 @@ function PlaceholderType(props) {
8989
case "number":
9090
setValidatePlaceholder("12345");
9191
break;
92-
case textInputWidget:
93-
setValidatePlaceholder("enter text");
92+
case "text":
93+
setValidatePlaceholder("please enter text");
9494
break;
9595
default:
96-
setValidatePlaceholder("enter text");
96+
setValidatePlaceholder("please enter value");
9797
}
9898
}
9999

@@ -407,7 +407,7 @@ function PlaceholderType(props) {
407407
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
408408
<textarea
409409
ref={inputRef}
410-
placeholder={validatePlaceholder}
410+
placeholder={validatePlaceholder || "please enter value"}
411411
rows={1}
412412
onKeyDown={handleEnterPress}
413413
value={textValue}
@@ -710,7 +710,7 @@ function PlaceholderType(props) {
710710
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
711711
<textarea
712712
ref={inputRef}
713-
placeholder={"email"}
713+
placeholder={"enter email"}
714714
rows={1}
715715
onKeyDown={handleEnterPress}
716716
value={textValue}
@@ -782,7 +782,7 @@ function PlaceholderType(props) {
782782
case textWidget:
783783
return (
784784
<textarea
785-
placeholder="Enter label"
785+
placeholder="Enter text"
786786
rows={1}
787787
onKeyDown={handleEnterPress}
788788
value={textValue}

apps/OpenSign/src/components/pdf/WidgetNameModal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const WidgetNameModal = (props) => {
1313
defaultValue: "",
1414
status: "required",
1515
hint: "",
16-
textvalidate: "text"
16+
textvalidate: ""
1717
});
1818
const [isValid, setIsValid] = useState(true);
1919
const statusArr = ["Required", "Optional"];
@@ -48,7 +48,7 @@ const WidgetNameModal = (props) => {
4848
defaultValue: "",
4949
status: "required",
5050
hint: "",
51-
textvalidate: "text"
51+
textvalidate: ""
5252
});
5353
}
5454
};
@@ -82,7 +82,7 @@ const WidgetNameModal = (props) => {
8282

8383
function handleBlurRegex() {
8484
if (!formdata.textvalidate) {
85-
setFormdata({ ...formdata, textvalidate: "text" });
85+
setFormdata({ ...formdata, textvalidate: "" });
8686
} else {
8787
if (formdata.defaultValue) {
8888
const regexObject = RegexParser(

apps/OpenSign/src/constant/Utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,15 @@ export const addWidgetOptions = (type) => {
323323
options: { isReadOnly: false, isHideLabel: false }
324324
};
325325
case textInputWidget:
326-
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
326+
return { ...defaultOpt };
327327
case "initials":
328328
return defaultOpt;
329329
case "name":
330-
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
330+
return { ...defaultOpt };
331331
case "company":
332-
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
332+
return { ...defaultOpt };
333333
case "job title":
334-
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
334+
return { ...defaultOpt };
335335
case "date":
336336
return {
337337
...defaultOpt,

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,10 +1375,7 @@ function PlaceHolderSign() {
13751375
inputype = options.includes(defaultdata.textvalidate)
13761376
? defaultdata.textvalidate
13771377
: "regex";
1378-
} else {
1379-
inputype = "text";
13801378
}
1381-
13821379
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
13831380
if (filterSignerPos.length > 0) {
13841381
const getPlaceHolder = filterSignerPos[0].placeHolder;
@@ -1401,11 +1398,14 @@ function PlaceHolderSign() {
14011398
status: defaultdata?.status || "required",
14021399
hint: defaultdata?.hint || "",
14031400
defaultValue: defaultdata?.defaultValue || "",
1404-
validation: {
1405-
type: inputype,
1406-
pattern:
1407-
inputype === "regex" ? defaultdata.textvalidate : ""
1408-
}
1401+
validation:
1402+
(isSubscribe || !isEnableSubscription) && inputype
1403+
? {
1404+
type: inputype,
1405+
pattern:
1406+
inputype === "regex" ? defaultdata.textvalidate : ""
1407+
}
1408+
: {}
14091409
}
14101410
};
14111411
} else {
@@ -1695,7 +1695,10 @@ function PlaceHolderSign() {
16951695
style={{ padding: 20 }}
16961696
>
16971697
{isSendAlert.mssg === "sure" ? (
1698-
<span>Please add at least one signature field for all recipients.</span>
1698+
<span>
1699+
Please add at least one signature field for all
1700+
recipients.
1701+
</span>
16991702
) : isSendAlert.mssg === textWidget ? (
17001703
<p>Please confirm that you have filled the text field.</p>
17011704
) : (

0 commit comments

Comments
 (0)