tabindex not working in contact form (using Flash AS2)
I have a contact form on my site for which the text inputs are created via AS2. This works fine but I cannot get the tabbing to work (or even have any effect) no matter what I do. I have a menu that sometimes displays at the top, sometimes on the left and sometimes at the bottom. If it's at the top or bottom then the form tabbing works fine, however if it's down the side then when i tab from contact_namefield it goes to the 8th menu option, then the 9th menu option, then contact_emailfield then contact_messagefield. Similarly if i tab from the top of the menu it's goes down sequentially to menu option 7, then to contact_namefield, then menu option 8, then menu option 9 then contact_emailfield then contact_messagefield. I cannot for the life of me work out how to change this, I would rather avoid setting tabenabled=false for every other element on the page (as i'd still like these to be tabbed), but either way I don't think this will fix it as the tabindexes i've specified seem to be having no affect at all, no matter what values i put in (even if i reverse them) the tab order is always exactly the same. I am using the following code and would be so grateful if anyone could point out what i'm doing wrong as I can't for the life of me figure it out!
var currfont=_root.textfont;
var inputcol = "0x" + _root.textcolour;
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = false;
my_fmt.font = "Arial";
my_fmt.color = inputcol;
createTextField("contact_namefield", getNextHighestDepth(),112.6, 29, 174, 20);
contact_namefield.wordWrap = true;
contact_namefield.multiline = false;
contact_namefield.border = true;
contact_namefield.borderColor = inputcol;
contact_namefield.type = "input";
contact_namefield.setNewTextFormat(my_fmt);
contact_namefield.text = "";
contact_namefield.tabEnabled=true;
contact_namefield.tabindex = 0;
createTextField("contact_emailfield", getNextHighestDepth(),112.6, 74, 174, 20);
contact_emailfield.wordWrap = true;
contact_emailfield.multiline = false;
contact_emailfield.border = true;
contact_emailfield.borderColor = inputcol;
contact_emailfield.type = "input";
contact_emailfield.setNewTextFormat(my_fmt);
contact_emailfield.text = "";
contact_emailfield.tabEnabled=true;
contact_emailfield.tabindex = 1;
createTextField("contact_messagefield", getNextHighestDepth(),112.6, 120.3, 174, 125.6);
contact_messagefield.wordWrap = true;
contact_messagefield.multiline = false;
contact_messagefield.border = true;
contact_messagefield.borderColor = i开发者_高级运维nputcol;
contact_messagefield.type = "input";
contact_messagefield.setNewTextFormat(my_fmt);
contact_messagefield.text = "";
contact_messagefield.tabEnabled=true;
contact_messagefield.tabindex = 2;
Thanks so much for your help as ever everyone,
Dave
I found this thread searching for a reason my tabIndex isn't working, and this may not solve your problem, but from the adobe website: "The tabIndex property must be a positive integer". Your first index as 0, which is nonnegative, but not positive. Try starting at 1.
It is {tabIndex} not {tabindex}
var currfont=_root.textfont;
var inputcol = "0x" + _root.textcolour;
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = false;
my_fmt.font = "Arial";
my_fmt.color = inputcol;
myTxt=["contact_namefield", "contact_emailfield", "contact_messagefield"];
createTextField(myTxt[0], getNextHighestDepth(),112.6, 29, 174, 20);
createTextField(myTxt[1], getNextHighestDepth(),112.6, 74, 174, 20);
createTextField(myTxt[2], getNextHighestDepth(),112.6, 120.3, 174, 125.6);
for (var x=0; x< myTxt.length; x++) {
eval(myTxt[x]).wordWrap = true;
eval(myTxt[x]).multiline = false;
eval(myTxt[x]).border = true;
eval(myTxt[x]).borderColor = inputcol;
eval(myTxt[x]).type = "input";
eval(myTxt[x]).setNewTextFormat(my_fmt);
eval(myTxt[x]).text = "";
eval(myTxt[x]).tabEnabled=true;
eval(myTxt[x]).tabIndex = x;//or (x+1);
}
精彩评论