mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-21 23:22:35 +02:00
fix: input regex validation issue
This commit is contained in:
+4
-3
@@ -40,6 +40,7 @@
|
||||
"react-select": "^5.8.0",
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"reactour": "^1.19.1",
|
||||
"regex-parser": "^2.3.0",
|
||||
"web-vitals": "^2.1.4"
|
||||
}
|
||||
},
|
||||
@@ -18471,9 +18472,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/regex-parser": {
|
||||
"version": "2.2.11",
|
||||
"resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz",
|
||||
"integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q=="
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.3.0.tgz",
|
||||
"integrity": "sha512-TVILVSz2jY5D47F4mA4MppkBrafEaiUWJO/TcZHEIuI13AqoZMkK1WMA4Om1YkYbTx+9Ki1/tSUXbceyr9saRg=="
|
||||
},
|
||||
"node_modules/regexp.prototype.flags": {
|
||||
"version": "1.5.1",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"react-select": "^5.8.0",
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"reactour": "^1.19.1",
|
||||
"regex-parser": "^2.3.0",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { onChangeInput } from "../../utils/Utils";
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import "../../css/signature.css";
|
||||
import RegexParser from "regex-parser";
|
||||
|
||||
function PlaceholderType(props) {
|
||||
const type = props.pos.type;
|
||||
@@ -18,8 +19,12 @@ function PlaceholderType(props) {
|
||||
});
|
||||
|
||||
const validateExpression = (regexValidation) => {
|
||||
const regexObject = new RegExp(regexValidation);
|
||||
let regexObject = regexValidation;
|
||||
if (props.pos?.options.validation.type === "regex") {
|
||||
regexObject = RegexParser(regexValidation);
|
||||
}
|
||||
|
||||
// new RegExp(regexValidation);
|
||||
let isValidate = regexObject.test(textValue);
|
||||
if (!isValidate) {
|
||||
props.setValidateAlert(true);
|
||||
|
||||
Reference in New Issue
Block a user