Previous | Next | (P-PDF) JavaScript
Topic: AutoTab and backspace key
Conf: (P-PDF) JavaScript, Msg: 104484
From: gman
Date: 1/23/2004 04:00 PM
Below is a function that I am using to perform AutoTabbing functionality.
function AutoTabAlphaNumeric(doc, event, cNext)
{
var re = /^\w$/
if (event.willCommit == false) {
if (re.test(event.change) == false) {
app.beep();
event.rc = false;
} else {
doc.getField(cNext).setFocus();
}
}
}
It's based on a function that I grabbed from the PlanetPDF website one time or another in the past.
The issue that I have is that I am not able to delete an alpha numeric character that I have already entered. As can be seen in my code above I am of course trapping every keypress other than an alpha numeric but I don't know what the regular expression metacharacter is for the backspace key.
I have tried /[\b]/ but that doesn't seem to work.
I have also tried:
if (event.change.charCodeAt(0) == 8 ) { ...
but with no results.
Any help would be greatly appreciated.
Cheers
Gerard Corboz
IT Manager
Perform
www.perform.net.au