Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

I want to create a text box that only allows a tick, N/A, A, R, X & D and will auto capitilise. I have 42 of these text boxes on my document!

Guest
Oct 24, 2016 Oct 24, 2016

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;

}

TOPICS
Acrobat SDK and JavaScript
735
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2016 Oct 24, 2016

Why not simply use a drop-down menu?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 24, 2016 Oct 24, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 25, 2016 Oct 25, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 24, 2016 Oct 24, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2016 Oct 25, 2016

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 25, 2016 Oct 25, 2016

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2016 Oct 25, 2016

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 25, 2016 Oct 25, 2016

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines