Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Force text fields to Uppercase
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Force text fields to Uppercase

 Post Reply Post Reply
Author
graniteman View Drop Down
New Member
New Member
Avatar

Joined: 21 Jul 2012
Points: 1
Post Options Post Options   Quote graniteman Quote  Post ReplyReply Direct Link To This Post Topic: Force text fields to Uppercase
    Posted: 21 Jul 2012 at 12:22am
Kind people 

I'm struggling with the concept of using javascript to convert lowercase to uppercase in all text fields in a document. I'm using this as Document Javascript:

var nameField = this.getField('Text');
nameField.setAction('Keystroke', 'forceUpperCase()');

function forceUpperCase()
{
    if(!event.willCommit)
        event.change = event.change.toUpperCase();
};

But, this only for for the Field called "Text". What about the fields called "Text1", "Text2" etc?

Is it possible to force uppercase in each field without having to use a custom keystroke script, or a validate field script.

Any help would be gratefully received.

Cheers

Back to Top
Sponsored Links


Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 628
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 22 Jul 2012 at 9:18am
Only the function needs to be in the doc-level. The first part of the code only needs to be executed once, possibly from the console.

What you can do is write a function that iterates over all the fields in the file (using getNthFieldName()), checks if they are text fields (using the type property) and if so, sets the keystroke action, like you did here.

Of course, you'll need to run it again if you add more fields...
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.