Skip to main content
Participant
September 2, 2017
Answered

JavaScript code for a text box that only allows upper and lowercase letters and white spaces only for entering a person’s first and last name only.

  • September 2, 2017
  • 2 replies
  • 1889 views

I'm way out of my league. I have very little knowledge about coding of any form. I need a custom format script, custom keystroke script and I think the run custom validation script. If possible, could someone please direct me to a easy to use learning program for JavaScript coding for Adobe Acrobat Pro DC as well as somewhere for the time being I can copy and paste quick codes for Adobe Acrobat Pro DC so that I am able to quickly insert restrictions or only allow certain keys? Quick background I got an Internship and they assumed I knew how to do coding. I said that I did not. Their response well you better figure it out, so I’ve been at this since 5:00am and its now 8:14 pm. Researching how to do it with hardly any improvements. I keep leaving out or not putting the code in the rite context or it just doesn’t work. I also researched copy and paste methods and there’s really nothing out there any help would be greatly appreciated. I’m running out of time.

This topic has been closed for replies.
Correct answer Test Screen Name

It may be a good time to learn coding, as "programming by cut and paste" is not the magic bullet that many people assume. I don't write code for people but you might like to consider your exclusion rules carefully. Here are some real names you would block

d'Arenberg

van-der-Valk

de Vogüé

Believe me, people get VERY upset if they are told they can't type their name. If I were doing this I'd consider excluding the character @ because the most common error is going to be putting an email address, but allowing everything else.

2 replies

try67
Community Expert
Community Expert
September 2, 2017

As mentioned, it's not a good idea to block all characters except for letters and spaces.

Instead, use this code as the field's custom Keystroke code to block numbers and the @ symbol:

event.rc = /[\d@]/.test(event.change)==false;

Test Screen NameCorrect answer
Legend
September 2, 2017

It may be a good time to learn coding, as "programming by cut and paste" is not the magic bullet that many people assume. I don't write code for people but you might like to consider your exclusion rules carefully. Here are some real names you would block

d'Arenberg

van-der-Valk

de Vogüé

Believe me, people get VERY upset if they are told they can't type their name. If I were doing this I'd consider excluding the character @ because the most common error is going to be putting an email address, but allowing everything else.