how to make a form field all caps

I'm trying to force a form field to be all in caps using acrobat XI anyone know how to do this


ericconner


3 Answers

Voted Best Answer

There are various possibliitles to accomplish that.

a) turn every input into upper case when data is entered; that would be in the Keystroke event:

if (event.change.length > 0) { event.change = event.change.toUpperCase() }


b) make everything all caps after committing; that would be in the Validate event:

event.value = event.value.toString().toUpperCase() ;


c) make everything all caps, but just for display purposes; that would be in the Format event:

event.value = event.value.toString().toUpperCase() ;


And that should do it.

Hope this can help.


Max wyss.


By Max Wyss   

It's the same no matter what version you are using. Except that since you're on A11, it's a good bet that you are working on an AcroForm;)

Add this script to the custom keystroke script:

if(!event.willCommit)
event.change = event.change.toUpperCase();

You can read more about it here:
http://acrobatusers.com/tutorials/formatting_text_fields

Thom Parker
The source for PDF Scripting Info pdfscripting.com
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker   

I was a bit confused by Max Wyss' answer (sorry, Max!), but found Thom Parker's spot on - when I entered his code...

if(!event.willCommit)
event.change = event.change.toUpperCase();

... in Acrobat XI's Text field properties > Format > Custom keystroke script box (as Thom suggests). All I can add is the 'Custom format script' box remains blank.


Peter Mann   


Please specify a reason: