Skip to main content
chrislee123
Participating Frequently
March 18, 2019
Answered

Limit Number of Characters in Dropdown List

  • March 18, 2019
  • 1 reply
  • 1739 views

In my dropdown list, I selected the option "Allow user to enter custom text". The problem is that the user can enter an infinite about of text and I'd like to limit the number of characters so that text longer than the visible area can't scroll. There are no options that will allow me to do this in a dropdown list like there are in a text box. Is there a script that I can add to my dropdown list?

This topic has been closed for replies.
Correct answer try67

You can use this code as the field's custom Keystroke script to limit it to 10 characters:

event.rc = AFMergeChange(event).length<=10;

The code will probably disappear after you enter it. That's OK. It's still there and should work.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 18, 2019

You can use this code as the field's custom Keystroke script to limit it to 10 characters:

event.rc = AFMergeChange(event).length<=10;

The code will probably disappear after you enter it. That's OK. It's still there and should work.

chrislee123
Participating Frequently
March 18, 2019

This worked. Thank you! Especially for the disclaimer about the code disappearing. It did disappear but still worked. That would have confused me.

A tip for anyone else has the same problem: Make sure that the character limit is equal to or greater than the number of characters of your longest option in your dropdown so that you don't accidentally block the user from being able to select any options.