Skip to main content
Participant
October 6, 2022
Answered

How to create a text only format on text box

  • October 6, 2022
  • 1 reply
  • 1687 views

I've created a fillable form and i'd like to create a text only textbox.

For instance, it's possible to create a date-specific text box, I'd like to do the same but only for text only and no other characters.

 

Please advise? 

This topic has been closed for replies.
Correct answer try67

Did you test this code? Because it doesn't work... Instead, use this as the field's custom Keystroke script:

 

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

1 reply

BarlaeDC
Community Expert
Community Expert
October 6, 2022

Hi,

 

You can do that on the validate of the field something like this

// event.rc = return true to let the value stay in the field, false to revert
// event.value.match = test the string against a Regex, returns true or false
// "[A-z]" - regex that allows all capital and lower case letters.
event.rc = event.value.match("[A-z]");

 

 

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 6, 2022

Did you test this code? Because it doesn't work... Instead, use this as the field's custom Keystroke script:

 

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

BarlaeDC
Community Expert
Community Expert
October 6, 2022

yes and it worked, although I had more than one text field, as the field has to loose focus for the code to run,