Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Wierd tab order issue using blur / setFocus
  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.

Wierd tab order issue using blur / setFocus

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


Joined: 21 Sep 2012
Points: 4
Post Options Post Options   Quote tronied Quote  Post ReplyReply Direct Link To This Post Topic: Wierd tab order issue using blur / setFocus
    Posted: 21 Sep 2012 at 10:01am
Hi,

I am having an issue with using Javascript to determine the tab order. I cannot use Adobe Professional for this so I am stuck trying to use JS. I am using a blur event which works fine when the user tabs away. What I want it to do is set the focus to another field, but it is doing something wierd. Say I have four fields such as:

TextBox1
TextBox2
TextBox3
TextBox4

The normal tab order would be to go through from 1 to 4. What I want it to do is go from 1 to 3, 3 to 2 and finally 2 to 4. I have the following code:

try
{
    app.alert("TextBox1 -> TextBox3");
    var textBox3 = this.getField("TextBox3");
    textBox3.setFocus();
}
catch(e)
{
    app.alert("Error in field"+e);
}

When I run it, it correctly fires the blur event but instead of going from 1 -> 3, it goes to 2 then to 3. My question is, has anyone else come across this behaviour at all? It seems wierd for setFocus to have to manually run through all the controls in the tab order before it can focus on the control I wanted. The problem here is that if TextBox2 has it's own blur event (which it does) the code to focus on something else will override my original and screw up the tab order.

Any ideas on how to get around this issue? I take it this is either just the way AcroJS works or is a bug.

Thanks in advance.
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: 21 Sep 2012 at 10:07am
Not sure what you're trying to do that the normal "tab order" functions wouldn't do?
Back to Top
tronied View Drop Down
New Member
New Member


Joined: 21 Sep 2012
Points: 4
Post Options Post Options   Quote tronied Quote  Post ReplyReply Direct Link To This Post Posted: 21 Sep 2012 at 11:14am
If you're referring to the tab order function in Adobe Professional, then I think I already answered that at the beginning of my message. I am also aware of the annotations / tab order method in the PDF specification, but I am trying to do this in AcroJS.
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: 21 Sep 2012 at 12:22pm
Well, I saw you say " I cannot use Adobe Professional for this" but I don't know why.
Back to Top
tronied View Drop Down
New Member
New Member


Joined: 21 Sep 2012
Points: 4
Post Options Post Options   Quote tronied Quote  Post ReplyReply Direct Link To This Post Posted: 21 Sep 2012 at 2:09pm
I am working for a company which develops and uses Apache FOP. This is a customer issue and we can't simply tell them that for every PDF now and in the future they should go and buy a license of Acrobat Pro and change the tab order that way. An enhancement has been submitted and will be probably implemented by me to support the annotation / tabs change, but until that time I want to get an answer or a workaround to the issue at hand.

So, any ideas?


Edited by tronied - 21 Sep 2012 at 2:16pm
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: 21 Sep 2012 at 2:39pm
Ok, I understand: you aren't using Acrobat and don't have another tool to set tab order. I understood your post to mean "I have Acrobat but for whatever reason I won't use this function in it".
 
I think you are making a big problem for yourself, as the tab order won't go away. Your symptoms suggest that Acrobat is tabbing to field2, then activating your on blur, which changes focus some more and will result in two fields getting focus.
 
This suggests you'd need a way to distinguish between getting the focus from tabbing and getting the focus from your own efforts. Well, you could set a variable around your setFocus call, and perhaps the on focus event can test it.
 
I would expect this to have the potential to change and break between releases of Acrobat.
 
Another idea is to investigate the order of generation of annotations, to see if you can get them created in the right order.
Back to Top
tronied View Drop Down
New Member
New Member


Joined: 21 Sep 2012
Points: 4
Post Options Post Options   Quote tronied Quote  Post ReplyReply Direct Link To This Post Posted: 21 Sep 2012 at 3:08pm
Thanks for your help. I will give it a go and see if I can get something to work. Anything to do with altering how the PDF is generated will be a longer term thing, so i'll address that with the enhancement. Anyway, thanks again.
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.