Copy link to clipboard
Copied
I am trying to create 42 text boxes that will only allow the user to enter the following: a tick (check), N/A, A, R, X & D. I would also like it to auto capitalise. I'm using acrobat pro & am very new to form design and javascript. I would appreciate any help because the coding I've found so far doesn't work!
I have entered as custom keystroke script
// Allow just the letter specified
function alphaOnly_ks()
event.change = event.change.toUpperCase()
and in my page actions:
// Allow just the letter specified
function alphaOnly_ks() {
// Get all of the characters that have been entered in to the field
var value = AFMergeChange(event);
// Do nothing if field is blank
if(!value) return;
// Reject the entry if the entry doesn't match the regular expression
if(!AFExactMatch(/^[✓,N/A,A,R,X,Dn/a,a,r,x,d\s\/]+$/, value)) event.rc = false;
}
Copy link to clipboard
Copied
Why not simply use a drop-down menu?
Copy link to clipboard
Copied
Do you want to change the entered text to all caps as the text is entered or after the text has been entered.
Do you want to block any characters not in your list as they are attempted to be entered or on exit from the field?
How many characters will you allow to be entered?
Copy link to clipboard
Copied
gkaiseril - a) it doesn't matter - whichever is easier!
b) for ease of use (as it is on an iPad using PDF Max 5 Expert), I think it would be better to block as they are attempted to be entered.
c) The max amount of characters can only be N/A, but they should not be able to answer A & D for example. The answer can only be one of the choices so a tick or N/A or. A etc.
Copy link to clipboard
Copied
Thank you for your replies!
try67 - I did this originally but, the forms are for my brother to use on an iPad Air using PDF Max 5 Expert and the dropbox appears large and to the left, which covers the questions ... it also does not disappear until you tab through the form, which is a bit cumbersome.
gkaiseril - a) it doesn't matter - whichever is easier!
b) for ease of use (as it is on an iPad using PDF Max 5 Expert), I think it would be better to block as they are attempted to be entered.
c) The max amount of characters can only be N/A, but they should not be able to answer A & D for example. The answer can only be one of the choices so a tick or N/A or. A etc.
Copy link to clipboard
Copied
Most scripts don't work at all, or only partially, on mobile devices. It depends a lot on the device and on the app used to open the file. I'm not familiar with the app you mentioned but the best one for iOS devices is Readdle's PDF Expert.
I would go for a slightly cumbersome, but simple, solution than for one that is complicated to create and might not work at all...
Copy link to clipboard
Copied
Thank you try67 ... that's the app he has. Is is possible then to make the dropdown box appear at the bottom of the page? The form I am creating is a very detailed worksheet; basically a checklist. It has 42 categories which are lines of instructions/things to check and therefore would have 42 very small dropdown's that are aligned one below the other.
Sorry if I seem ignorant of the basics. This is the first time I have tried to do this and it seems there is a lot I need to learn!
Copy link to clipboard
Copied
You can place the field anywhere you want on the page. However, if the application is displaying the menu in a specific location on the screen there's probably not much you can do about that. Contact the authors of that application and ask if it's possible or not...
Copy link to clipboard
Copied
Ok, thank you .. that's a good idea. It's so disappointing that I cannot code it as I presume it would be quite a basic operation, I know it was so in DOS albeit many years ago when I used to do that!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now