PDA

View Full Version : setting tab index at runtime, please help


zamfir
06-06-2005, 03:42 PM
I've got some textboxes that are being hidden/unhidden depending on a number the user inputs. Here's the code to do that:

DS1container = function () {
if (DS1Quantity<1) {
showAlert("DS1 Quantity must be a number between 1 and 28.", "ALERT");
DS1Quantity = 1;
}
if (DS1Quantity>28) {
showAlert("DS1 Quantity must be a number between 1 and 28.", "ALERT");
DS1Quantity = 28;
}
for (var i = 1; i<29; i++) {
if (i<=DS1Quantity) {
_root["DS1CircuitNo"+i+"_txt"]._visible = true;
_root["DS1CircuitNo"+i+"_txt"].restrict = "0-9";
_root["DS1CircuitNo"+i+"_txt"].tabIndex = (i+2);
_root["DS1CircuitNo"+i+"_txt"].tabEnabled = true;
} else {
_root["DS1CircuitNo"+i+"_txt"]._visible = false;
_root["DS1CircuitNo"+i+"_txt"].enabled = false;
_root["DS1CircuitNo"+i+"_txt"].tabEnabled = false;
}
}
};

As you can see, I'm hiding all the boxes that are numbered higher than the variable "DS1Quantity" and setting the tabEnabled property to false, for all the other boxes that are visible I'm setting the tabIndex and setting tabEnabled to true.
I have a trace set up to tell me the tabindex of the boxes, and whether the boxes are tab enabled, and it traces what I would expect, if the box is visible it has a tabIndex and tabEnabled traces true. HOWEVER, at run time, I cannot tab to any but the first text box, even though the tabs are correct and the tex boxes are tab enabled. Any ideas? It's driving me crazy. I've got the "It should work" blues.