Field Tab on Full

| 7 Comments

When a form author needs to capture data where there are several related fields with fixed numbers of characters, they should try to make the separate fields behave like one continuous field.

The best example I can think of is when I'm filling in a multi-part serial number.  The number usually gets broken out into several input fields.  As soon as one input field is full, you are automatically tabbed over to the next field. If you paste a long value into the first field, the pasted value is used to populate all the fields in the sequence.

Occasionally I run into a dialog box that prompts for a serial number but doesn't give me the auto-tab and auto-paste-fill experience, and I get ... angry.  How dare they force me to transcribe a 15 digit number digit-by-digit?

Today's example shows how to bring the auto-tab and auto-paste-fill experience to a PDF form.  The sample form captures a social security number as a sequence of 3, 2 and 4 characters in 3 separate fields.

Prerequisites

For the fields of the sequence to work in concert, the script needs to know three things:

a) How many characters are in each field
b) which fields participate in the sequence
c) What order are the fields in?

The sample does this by:

  1. Define each field in the sequence as a text field with a maximum number of characters (field.value.text.maxChars).
  2. Define a custom tab order.  The next field is defined in the markup: field.traversal.traverse.ref

The sequence of fields could easily be defined in a different way.  My alternate choice would be to wrap the fields of the sequence in a subform and assume that they are in document order.

Change Event

When a user types or pastes, the change event fires.  The change event checks for:

  • If there's more text than fits, spread the leftover text among the next fields in the sequence according to their maxChars capacity.
  • If the user's input has caused the field to reach its maxChars value, set focus to the next field in the sequence.

Futures

There's more that could be done.  The form could (and should) have tested the digits to make sure they're valid for a social security number.  On deleting the last character from a field the form could automatically tab to the previous field.

 

I won't be blogging for a bit.  I will be on vacation all next week.  In the mean time, happy form designing.

7 Comments

John,

I was thinking about this functionality yesterday for a phone field.

This really is the perfect Easter gift :)

Enjoy your vacation.

This is what I am looking to do, however, I am new to livecycle and do not know how to do what you are saying. Where do I enter that information?

Jason:

Open the sample form (Overflow.pdf) in Acrobat or Reader and paste the value "987654320" into the first box of the social security number.

John

I have read this blog and this is something I am looking to do on my form, only I am not sure how to execute your instructions. I have gone to the script editor in my adobe live cyvle designer program 8.0 and I can not decipher how to enter the code that you have given. Like the gentleman above, I have have not yet figured out my way around livecycle. I did enough to get the form up and running, but I too have a sequence of 9 digits that need to be connected.

Any help you can provide will be greatly appreciated.

Chaunte:

If you have a sequence of field that you want to link together, follow these steps for all but the last field:
1) Select the field
2) go to the script editor and from the "show" drop-down list, select "change" (the change event)
3) enter this script:
FullEvent.checkFull(this);

Then make sure you have copied the "FullEvent" script object to your form:
1) Right click on your root subform and choose "insert script object"
2) rename the script object to "FullEvent".
3) copy/paste the code from the FullEvent object in my sample into your new script object.

good luck!

John

I'm running Acrobat 8, is there anyway to get Autotab or this overflow to work?

Danielle:
The sample form is designed for Acrobat/Reader 8.1, but the functionality works fine in 8.0 as well. Try designing an 8.0 form and copying the content from the sample into your form.

John

Leave a comment

About this Entry

This page contains a single entry by John Brinkman published on April 9, 2009 3:34 PM.

Layout Methods to Find Page Positions was the previous entry in this blog.

Performance of Object Expressions is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.