开发者

Populating values from one textbox to another

<input type="text" class="formtext" id="t${status.index}" 
       name="List.lItemList<c:out value='[${status.index}]'/>.value1" 
       value="0.0"
       onChange="validateOnChange(this,'desc','minvalue','maxValue','float')" 
       onKeyUp = "document.getElementById('t${status.index+1}').value=this.value">  

 <input type="text" class="formtext" id="t${status.index+1}"              
        name="List.clItemList<c:out value='[${status.index}]'/>.value2"
        value="0.0"
        onChange="validateOnChange(this,'desc','minvalue','maxvalue','float')"> 

In the above code I have two text boxes in a particular row:

1st row: textbox1 textbox2

2nd row: textbox3 textbox4

When I enter the value in one of the textboxes , it needs to be copied to other textbox simultaneously. So I am using an KeyUp event to update the textbox. But the ID for each textbox is giving issues. Regardless of which textbox I update, only textbox2 is updated. I want it to be updated based on the row.

Ex = For each itemlist[i] { 
    Inp开发者_JAVA百科ut type(id = status.index[i] onkeyup) 
    input type(id = status.index[i]+1 update the value entered on the 1st textbox ) 
} repeat


onKeyUp = "this.form[this.name.replace('value1','value2')].value=this.value"

in case you delete the other one

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜