Skip to main content
stepheng54012748
Known Participant
November 15, 2024
Answered

Javascript for an event in a field

  • November 15, 2024
  • 1 reply
  • 540 views

Good morning,

 

I've been working on writing a script for an event in a particular field.  My goal is to all only is to allow only alphabet letters (capital or lower case).  I don't want to limit the number of characters and will make the settings autofit the cell depending on the length of the letters. I don't what characters, symbols or numbers, just letters.  Below is the script i've come up with.  I put the event script in the "run custom valization script".  When i tested i didn't quite get the result I'm looking for.  I feel like i'm close but my result is only allowing me one letter.  Arbitrary Mask doesn't work because it is limited.  Thank you in advance for any input.  Here is the script:

 

if (event.value) {

event.rc = /^[A-Za-z]$/.test(event.value);

}

This topic has been closed for replies.
Correct answer try67

Use this:

event.rc = /^[a-z]*$/i.test(event.value);

 

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 15, 2024

Use this:

event.rc = /^[a-z]*$/i.test(event.value);

 

stepheng54012748
Known Participant
November 15, 2024

Beautiful.  THANK YOU!!