0
votes
<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')">

Hi , 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 textbox , it needs to be copied to other textbox simultaneously.So i am using an onKeyUp 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.Thanks

Ex =
For each {
    Input type(id = status.index onkeyup)
    input type(id = status.index+1 update the value entered on the 1st textbox )
} repeat
2
Can't understand what is going on, can you add a sample code or add more clear info?Amr Elgarhy

2 Answers

0
votes

You need to add to the ID something that identify the row.

0
votes

How about

<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="this.form[this.name.replace('value1','value2')].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')">