Copy link to clipboard
Copied
Anyone have insight on the custom format script for creating text fields with alpha only input?
Copy link to clipboard
Copied
You can use this code as the custom Keystroke script:
if (event.change) event.rc = /^[a-z]+$/i.test(event.change);
Copy link to clipboard
Copied
You can use this code as the custom Keystroke script:
if (event.change) event.rc = /^[a-z]+$/i.test(event.change);
Copy link to clipboard
Copied
I have a field - Case Name, and I used the coding above - if (event.change) event.rc = /^[a-z]+$/i.test(event.change); - and yes I can only type alpha characters in it, which is great but I cannot put a space between the first and last name.
Example: Jane Doe becomes JaneDoe
Is there a way to allow spaces?
Thank you,
Jamie
Copy link to clipboard
Copied
Simply add a space character inside the square brackets.
However, names can contain all kinds of characters, beside letters and spaces. What about hyphens? Apostrophes? Periods?
Copy link to clipboard
Copied
Do not forget capitol letters.
Copy link to clipboard
Copied
Capital letters are already allowed by the script above, because of the "i" flag.
Copy link to clipboard
Copied
Hmm, I didn't think of those scenarios.
Can you direct me to maybe a pdf document or some source where I could find coding for spaces, hyphens and such.
Thanks!
Copy link to clipboard
Copied
Basically, you should insert all the characters you want to allow into the square brackets.
Copy link to clipboard
Copied
Got it, but how do I find out what represents the characters like for a space? Can you direct me to where I can go to look these items up?
Where I can find out what the coding that you provided is actually doing and what the symbols mean (bolded text below)?
if (event.change) event.rc = /^[a-z]+$/i.test(event.change);
Copy link to clipboard
Copied
See Special characters meaning in regular expressions
Then scroll down to "Character Classes"
\s Matches a single white space character, including space, tab, form feed, line feed and other Unicode spaces. Equivalent to [ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].
\t | Matches a horizontal tab. |
\r | Matches a carriage return. |
\n | Matches a linefeed. |
\v | Matches a vertical tab. |
\f | Matches a form-feed. |
[\b] | Matches a backspace. (Not to be confused with \b ) |
\0 | Matches a NUL character. Do not follow this with another digit. |
\cX | Where X is a letter from A - Z. Matches a control character in a string. |
if (event.change) event.rc = /^[a-zA-Z\s]+$/.test(event.change);
Copy link to clipboard
Copied
Thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now