PDA

View Full Version : dynamic textbox Naming and Focusing


Mr.P
09-08-2003, 08:13 PM
I am trying to create a dynamic table which has an input text field that should accept user input. This input text field is created when an user selected from a previous selection list which contains several entries. The problem which is occurring, When the user enter an value in one of the input text field name Hourtxt + count and click on the next input text field the cursor appears
to toggle between the previous input text field and new input field
as if it lose the FOCUS. I have try adding document.element.focus but that did not appears to fixed the problem. I have try adding a tabindex that did not appears to change a thing. I would appreciate another set of eye to help me determine what I am doing wrong to cause this behavior.

The count is the number of entries

the count is what I think I am using to concatenate the input text box name and tabindex in my quote string.

document.getElementById('prompt').innerHTML = document.getElementById('prompt').innerHTML + "<TABLE><\TR><TD ALIGN='CENTER' WIDTH ='90'><BR> 94494<\TD><TD COLOR ='RED' WIDTH ='170' ALIGN='RIGHT' >" + selectedText + "<\TD><TD COLOR='BLUE' WIDTH='190'><input type='text' name= 'hourtxt'+count' tabindex = '+count' size='3' MaxLength='3' id='promptbox' onblur='this.focus()' class='promptbox'></td><TD COLOR = 'GREEN' WIDTH = '225'>" + WoDetDate + "</TD></TR>";

SDP2006
09-08-2003, 09:08 PM
You might find your problem easier if you layed your code out a little cleaner :)

Mr.P
09-08-2003, 10:10 PM
Thanks, for your help. I have found the problem. and eradicate.
I was setting onblur method to set the focus inside the loop. This
was setting every input text with the focus simultaneously.
:)