Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - code to enforce additional required field
  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.

code to enforce additional required field

 Post Reply Post Reply
Author
lapr12 View Drop Down
New Member
New Member


Joined: 25 Oct 2012
Location: Midwest
Points: 3
Post Options Post Options   Quote lapr12 Quote  Post ReplyReply Direct Link To This Post Topic: code to enforce additional required field
    Posted: 25 Oct 2012 at 4:04am
I have a fillable pdf which I enforced field entry for field labelled A. So if user attempts to pass the field without filling in data in field A , a warning pops up telling user to fill the field. This warning repeatedly pops up until user enters data in field A. That works fine.
 
Here is the script I plugged in to properties box/ action tab/ blur which I found on the internet in a search
 
f = getField(event.target.name)
if (f.value.length == 0)
     {
     //Optional Message - Comment out the next line to remove
     app.alert("This field is required. Please enter a value.")
     f.setFocus()
     }
 
 
 
Problem occurs down at field W on last page, page 4 of pdf. I want both field W and field X to have enforced data entry.
When user attempts to pass field W without data entry, the warning pops up and just hangs there not accepting user attempts to click off the box to enter data. User has to use task manager to kill the pdf session.
From my reading on the internet there seems to be confusion for pdfs to handle additional fields of enforced entry, after the first.
 
I tried using dummy fields not displayed, in between W and X but it all comes back to the repeated pop ups
 
Any code would be helpful for these last few fields on this form
thx
 
Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 629
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 31 Mar 2013 at 11:03am
This is not a good method of enforcing users to fill in fields. It's annoying to the users and can be easily avoided by simply not tabbing into the files.
Instead, you should use the built-in required property. If there are empty required fields in a file it will not be possible to submit it back to you.
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
aandi View Drop Down
Senior Member
Senior Member


Joined: 07 Jul 2011
Points: 18358
Post Options Post Options   Quote aandi Quote  Post ReplyReply Direct Link To This Post Posted: 31 Mar 2013 at 11:35am
Yes, if I wasn't planning to fill in a field, I wouldn't click in it. I don't use tab anyway. I expect to be able to fill in a form in the order that suits me, not the order that suits the designer!
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.