cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 2.0 SP3: How to handle the pixel space for string with capital or low case letters?

Former Member
0 Kudos

Hi Personas 2.0 experts,

I have a "simple" issue:

On my personas UI, I have a text field for user to enter text string with max char of 40 chars. This input text will be copied to a SAP field (eg, the description field of IW21 which can hold max 40 chars no matter it is all in upper case or low case).

The issue is:

On my UI, the width of the input text field is fixed, and I found that the actual width of 40 low case letters is smaller than that of 40 upper case letters. So, if I set the text field as wide as the 40 upper case, user can tyep more than 40 low case letters there, and script will fail when doing copy. But if I set the text field width as wide as the 40 low case letters, user can only enter max 34 upper case letters, not 40 chars.

How do I do to allow user enter max 40 chars (either upper or low case letters)?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

OK, I answer myself:

There seems no better way. A workaround:

I set teh width of text field as for Upper case. Now user can enter 48 lower case letters, then I add script code:

newStr=originalStr.substr(0,40);

So I am always sure the str is no more than 40 chars long. The only drawback is that user may be suprised that his 48 chars is truncated to 40 chars after string copy action. Seems have to live this way. Set to Answered.

Dong

former_member105930
Active Participant
0 Kudos

Hi Dong,

Just wondering whether before you do the copy function you could use some simple javascript to return an error message if the user has entered too many characters?

Something along these lines:

Calculate in JavaScript if (args.value.length >40) {args.alert='X'}

IF then If args.alert = 'X'

Calculate in JavaScript alert("too many characters")

At least this way the field length will be checked before you execute the script containing the copy function?

Just a thought

Ian

Former Member
0 Kudos

Hi Ian,

Thanks for the helpful thought. The only thing is that there have been some alerts for other fields. User may be frastrated if there are too many alerts. I added a label on UI saying "(max 40 chars)", and when copying, just truncated if too many chars. For other more important fields, I have two alerts for user. Good idea anyway. Thx.

Dong

Answers (0)