Hi,
I am posting this question here.. Because I didn't find a new thread option..
When I use the RegExp [\~\^] or /[\~\^]/ as input for the “expression” attribute of “regexp” validatortype, the validation is not working. And the screen always gives error for any input chars with or without the mentioned special characters.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="regexp" expression="[\~\^]" errorMessage="Value must not contain either ^ or ~"></validator>
</validators>
</field>
To check if the validatortype “regexp” works fine or not, have tested for the expressions [0-9] or [A-Z] and they both are working fine for positive and negative scenarios. However they do not work for the validation of ^ or ~.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="regexp" expression="[0-9]" errorMessage="Value must contain only numeric </validator>
</validators>
</field>
Below is the javascript function which alerts whenever the input string contains ~ or ^ chars. The RegExp used below is working fine.
<body>
<script>
function validate(){
//var inp = "1ab@#cdf~e^";
var inp = document.getElementById('in').value;
if (RegExp(/[\~\^]/).test(inp)) {
alert("true");
return true;
}
else
{
alert("false");
return false;
}
}
</script>
<input type="text" id="in" />
<button name="clickbtn" onclick="validate()"> Click</button>
</body>
However, able to achieve the special characters validation for ~ or ^ by using below validatortype “contains”.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="contains" substring="~" errorMessage="Value must not contain ~ character"></validator>
<validator type="contains" substring="^" errorMessage="Value must not contain ^ character"></validator>
</validators>
</field>
We would like to know if it is possible to make the regexp work for the validation of ~ and ^.
Please do the needful..
Thanks in Advance.
I am posting this question here.. Because I didn't find a new thread option..
When I use the RegExp [\~\^] or /[\~\^]/ as input for the “expression” attribute of “regexp” validatortype, the validation is not working. And the screen always gives error for any input chars with or without the mentioned special characters.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="regexp" expression="[\~\^]" errorMessage="Value must not contain either ^ or ~"></validator>
</validators>
</field>
To check if the validatortype “regexp” works fine or not, have tested for the expressions [0-9] or [A-Z] and they both are working fine for positive and negative scenarios. However they do not work for the validation of ^ or ~.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="regexp" expression="[0-9]" errorMessage="Value must contain only numeric </validator>
</validators>
</field>
Below is the javascript function which alerts whenever the input string contains ~ or ^ chars. The RegExp used below is working fine.
<body>
<script>
function validate(){
//var inp = "1ab@#cdf~e^";
var inp = document.getElementById('in').value;
if (RegExp(/[\~\^]/).test(inp)) {
alert("true");
return true;
}
else
{
alert("false");
return false;
}
}
</script>
<input type="text" id="in" />
<button name="clickbtn" onclick="validate()"> Click</button>
</body>
However, able to achieve the special characters validation for ~ or ^ by using below validatortype “contains”.
<field name="II4_DOC_HEADER" type="text" >
<validators>
<validator type="contains" substring="~" errorMessage="Value must not contain ~ character"></validator>
<validator type="contains" substring="^" errorMessage="Value must not contain ^ character"></validator>
</validators>
</field>
We would like to know if it is possible to make the regexp work for the validation of ~ and ^.
Please do the needful..
Thanks in Advance.
Comment