Hi there, I came across this scenario , User just input type character (a-z) & just can input 3 special character .,’ in the test input and text area. Can you please specify the exact java code for this scenario ?
Hi @swinsikyas6591,
Create an Edit Validate Rule and use the below-mentioned Java code for the Edit Validate Rule.
Use this Edit Validate Rule in the Advance Tab of the property or Property Validate Method in Activity.
Note: Error Message: You can modify it according to your requirements. Not Allowed Other Than These Characters a-z , . ’
for (int pos = 0, len = theValue.length(); pos < len; ++pos)
{
char c = theValue.charAt(pos);
int ascii =(int)c;
if ((ascii<97 || ascii>122) && (ascii<39 || ascii>39) && (ascii<44 || ascii>44) && (ascii<46 || ascii>46))
{
theProperty.addMessage("Not Allowed Other Than These Characters a-z , . '");
return false;
}
}
return true;
Please go thorough below mentioned articles ,there I have wrote other methods too
how to prevent a user from entering special characters in input text and text area. and
Edit Validate Rule Customized Java Code
I hope this will help you.
Thanks,
Ashok