Skip to content

Commit 440d253

Browse files
Merge pull request #621 from OpenSignLabs/fix_issue
fix: text input validation issue if user not select any validation
2 parents ebeeedc + 2b6bf7b commit 440d253

File tree

5 files changed

+36
-30
lines changed

5 files changed

+36
-30
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/constant/saveFileSize.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import axios from "axios";
2-
const parseAppId = localStorage.getItem("parseAppId");
3-
const serverUrl = localStorage.getItem("baseUrl");
2+
const parseAppId = process.env.REACT_APP_APPID
3+
? process.env.REACT_APP_APPID
4+
: "opensign";
5+
const serverUrl = process.env.REACT_APP_SERVERURL
6+
? process.env.REACT_APP_SERVERURL
7+
: window.location.origin + "/api/app";
48

59
export const SaveFileSize = async (size, imageUrl, tenantId) => {
610
//checking server url and save file's size
@@ -12,7 +16,7 @@ export const SaveFileSize = async (size, imageUrl, tenantId) => {
1216
const _tenantPtr = JSON.stringify(tenantPtr);
1317
try {
1418
const res = await axios.get(
15-
`${serverUrl}classes/partners_TenantCredits?where={"PartnersTenant":${_tenantPtr}}`,
19+
`${serverUrl}/classes/partners_TenantCredits?where={"PartnersTenant":${_tenantPtr}}`,
1620
{
1721
headers: {
1822
"Content-Type": "application/json",
@@ -30,7 +34,7 @@ export const SaveFileSize = async (size, imageUrl, tenantId) => {
3034
: size
3135
};
3236
await axios.put(
33-
`${serverUrl}classes/partners_TenantCredits/${response[0].objectId}`,
37+
`${serverUrl}/classes/partners_TenantCredits/${response[0].objectId}`,
3438
data,
3539
{
3640
headers: {
@@ -41,7 +45,7 @@ export const SaveFileSize = async (size, imageUrl, tenantId) => {
4145
);
4246
} else {
4347
data = { usedStorage: size, PartnersTenant: tenantPtr };
44-
await axios.post(`${serverUrl}classes/partners_TenantCredits`, data, {
48+
await axios.post(`${serverUrl}/classes/partners_TenantCredits`, data, {
4549
headers: {
4650
"Content-Type": "application/json",
4751
"X-Parse-Application-Id": parseAppId
@@ -64,7 +68,7 @@ const saveDataFile = async (size, imageUrl, tenantPtr) => {
6468

6569
// console.log("data save",file, data)
6670
try {
67-
await axios.post(`${serverUrl}classes/partners_DataFiles`, data, {
71+
await axios.post(`${serverUrl}/classes/partners_DataFiles`, data, {
6872
headers: {
6973
"Content-Type": "application/json",
7074
"X-Parse-Application-Id": parseAppId
@@ -74,4 +78,3 @@ const saveDataFile = async (size, imageUrl, tenantPtr) => {
7478
console.log("err in save usage ", err);
7579
}
7680
};
77-

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)