Google
 
We have moved to a http://siebelunleased.com Please visit there for updated posts

Monday, October 15, 2007

Siebel CRM How To – Restrict a Field to only Accept Certain Characters?

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.
Solution:

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.

1 Comment:

gargoloco said...

Great tip!!! Thanks
U can see my blog too.
www.solucionessiebel.blogspot.com

You Might want to read following articles also.