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

Autotabbing fields that are set to only accept numbers (not letters)

Participant ,
Oct 17, 2019 Oct 17, 2019

Copy link to clipboard

Copied

Hello,

 

Disclaimer: I'm learning as I go, am not super technical and I'm sure there are better ways to do what I am trying to. Open to input but remember I am not skilled with Acrobat so patience please!

 

I am trying to do two things with my PDF form: have fields autotab, and also be limited to only 1 number per field.

 

At the moment, I have the autotabbing working, however I cannot seem to set the fields to be number only. I think this is because I have the autotabbing code set the FORMAT > Custom Keynote Script area:

// Autotab to the "P1: 3. HSBC 2" field tab_next("P1: 3. HSBC 2");

 

If I try setting the field to be a number only, in FORMAT > Number it removes what I have set in the custom area for the autotabbing.

 

I also have this javascript added in the ACTIONS tab:

 

// Document-level function function tab_next(next_field_name) { // Move to next field if Enter key is pressed // or the user has clicked outside of the field // or if the number of character is the character limit if (event.willCommit || AFMergeChange(event).length === event.target.charLimit) { getField(next_field_name).setFocus(); } }

 

If I could just get the individual fields to only show 1 number and still autotab then I would be one happy camper! Appreciate any help... thank youo in advance.

TOPICS
PDF forms

Views

1.4K

Translate

Translate

Report

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 18, 2019 Oct 18, 2019

Copy link to clipboard

Copied

Use a single text field with the Comb option enabled, instead of what you currently have.

Votes

Translate

Translate

Report

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
Participant ,
Oct 28, 2019 Oct 28, 2019

Copy link to clipboard

Copied

Thanks so much... that is exactly what I needed!

Votes

Translate

Translate

Report

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
New Here ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

I have the same question, but I am not understand the question. What does that mean? Sorry, beginner here... 

Votes

Translate

Translate

Report

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
New Here ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

I meant I am not understanding the solution. 

 

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

Hi Betty,

 

Just digging up my example file and will share with you.

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

Hi Betty,

 

So, you will need to add a document level javascript first. To do this:

 

  • In Acrobat Reader, click "Prepare form" on the right. 
  • Next, click the "More Tools" icon at the bottom
  • Then, under "Customize", click "JavaScript"
  • Once you do this, a JavaScript bar will appear near the top of the screen. Click "Document JavaScripts"
  • Give the script a name, click "Add", and paste this in:

// Document-level function function tab_next(next_field_name) { // Move to next field if Enter key is pressed // or the user has clicked outside of the field // or if the number of character is the character limit if (event.willCommit || AFMergeChange(event).length === event.target.charLimit) { getField(next_field_name).setFocus(); } }

 

  • Then click close



In my example attached, I needed to be able to click a radio button to activate the field(s) that corresponded. In mine, you can only select one of the three account types. You can double click the radio button(s) to see how I set these up to make fields visible/and invisible (click on "Actions" and click on "Run a JavaScript", and then "Edit" to see. It bascially tells the radio button(s) which fields to make visible and which fields to hide.


  • For the fields themselves, you need to do a few things to make them work.
    Double click on my "P1: 3. ABC account number - 1" field to bring up its properties. 
  • Click "Options", select "Comb" and set the number of characters you need that field to have (I needed 3 for this one)
  • Next, click on "Format" and click "Edit" next to the "Custom Keynote Script". I had to enter this, which tells the first field to auto tab to the next one.

 

// Autotab to the "P1: 3. ABC account number - 2" field tab_next("P1: 3. ABC account number - 2"); if(!event.willCommit) event.rc = /^\d*$/.test(event.change);

 

This gets repeated for the next field, updating the field name in the code above so that it autotabs to the third field (and I don't need to do that to the third field since I don't need it to auto tab any further).

 

For the last field, (P1: 3. ABC account number - 3), I do need to bring up its properties, click on "Format", and in "Custom Keynote Script" enter this:

 

if(!event.willCommit) event.rc = /^\d*$/.test(event.change);

 

Providing your tab order is set up properly you should be good to go.

 

I hope the attached example helps?

 

Thanks

This is what tells 

Votes

Translate

Translate

Report

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 ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

You can't do any of that in Acrobat Reader.

Votes

Translate

Translate

Report

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
Participant ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

LATEST

Yes, sorry. I meant Adobe Acrobat.

Votes

Translate

Translate

Report

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