It appears the exit event runs on a table's cell (type text field) whenever you select a new cell with the mouse. I have the need to force a Tab or Enter to set keyboard focus to a different cell in a different table. That is easy enough to have happen, but when you select a location with the mouse, the exit event appears to run, and over-rides the keyboard focus to the location I am forcing. Is there a way to skip the code if the exit event occurs from non-keyboard input?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
The exit event will always fire when the object loses focus. Have a look at the end of this example, which shows how you can detect how the field was exited: http://assure.ly/j1KdNq.
This early example also looked a setting the focus of a field when pressing enter: https://acrobat.com/#d=RZ1lzX23*u7L4N9rtWCYPQ.
Hope that helps,
Niall
Views
Replies
Total Likes
Hi,
The exit event will always fire when the object loses focus. Have a look at the end of this example, which shows how you can detect how the field was exited: http://assure.ly/j1KdNq.
This early example also looked a setting the focus of a field when pressing enter: https://acrobat.com/#d=RZ1lzX23*u7L4N9rtWCYPQ.
Hope that helps,
Niall
Views
Replies
Total Likes
Perfect! Thank you. Niall. I also found the Shift property helpful since the commitKey property did not return the correct direction. I made the following code, changing the end to go to the correct locations based on where the user is. In some cases it would go to either direction
// Declare some variables
var i = this.parent.index;
var i2 = xfa.event.commitKey;
var testResult = 0;
// Determine how the user exited the field
switch (i2)
{
case 0:
//value is not set, such as an escape key, so do nothing
break;
case 1:
//left clicked out with the mouse, so do nothing
break;
case 2:
//enter key, so go to next field
testResult = 1;
break;
case 3:
//tab, so check for the shift key and go the appropriate direction.
if (xfa.event.shift)
{
testResult = -1;
}
else
{
testResult = 1;
}
break;
default:
break;
}
if (testResult > 0)
{
//Set keyboard focus to the next first cell in this row of the next table if a tab was pressed
xfa.host.setFocus("TableLeft.ItemRow[" + i + "].Cell1");
}
else if (testResult < 0)
{
//Set keyboard focus to the previos cell in this row of the next table if a tab was pressed
//If this is the first row in the table, go back to the last cell in the header row
//If this is not the first row, go to the previous row
if (i>0)
{
xfa.host.setFocus("TableRight.ItemRow[" + (i - 1) + "].Cell15");
}
else
{
xfa.host.setFocus("TableRight.HeaderRow.Cell15");
}
}
Views
Replies
Total Likes
Views
Likes
Replies