Question
Max two changes restrction on a string
Hi All, We have this requirement in our project to restrict the user from modifying more than two letters of his full name. E.g. The existing Full name is John Smith, and if the user would like to modify his name on the account he can change a max of two chars.(adding, updating, or deleting) Case 1: John SmithXX - Allowed - two additional chars Case 2: JohnSmithXX - not allowed- removal of space and two additional chars,three changes Case 3:John Smi-ALlowed two char removals Case 4:John SmiXX Allowed two char modifiations, you get the point right. Has anyone done this before, or is there any Java OOTB api or code snippet/reg expression we can use. Thanks, Pradeep Gunda
Hi Pradeep,
1. First you need to make sure that you store the initial length of the data in some place holder property.
2. Now to fulfil your requirement, you have to design an onChange activity against that field which will trigger everytime there is a change in the value.
3. The on change activity use the function @String.length(str1) to get the size of the newly entered string and then compare it with the old value which is stored in the placeholder property
4. If it is greater than 2, then do a page set message
Just a thought !