Requirement:
- We have a multilingual application and we have Unicode enabled database but still we would like to restrict user from entering certain characters.
- We want to prevent user from entering numbers in alpha-numeric fields.
Use charCodeAt function given by Siebel but not documented properly by Siebel. Here I am giving a Pseudo code to explain how it can be used.
if (FieldName == "First Name") {
for (var i=0;i less than field length ;i++) {
var ASCII_code = fieldvalue.charCodeAt(i)
if(ASCII_code is not valid code)
Error("Not Valid Code");
}}
charCodeAt() returns the ASCII code of the character that is supplied to it. ASCII code comparison is way faster than the number function that are used to compare strings so we can also use this function where we want to compare two strings by just modifying the above given Pseudo code.
Hope this helps! If yes, Please put your comments below.
0 comments:
Post a Comment