+ Start a Discussion
jd123jd123 

How to give user defined id to an apex:image

Hi 

 

   I would like to give dynamic ids based on the no of result which I get.

 

Like 

 

newTextBoxDiv.after().html('<table><tr><td><input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" style="padding:5px 0px 0px 0px;" ></td><td style="display: block;"><img src="r-arrow.png" alt="" onClick="functionCall(this.id)" id="textBox2RightArrowImage1' + counter + '"></td>'+
'<td style="display: none;"><img src="d-arrow.png" alt="" id="textBox2DownArrowImage1' + counter + '"></td></tr></table>');

 

it is working in html but not in apex.

 

 

Any help is appreciated.

Subha ASubha A
You can use <apex:variable> and define a variable which can be incremented and used similarly like this.
jd123jd123
i have seen but it is not working.can you send me any example.
Subha ASubha A

<apex:variable value="{!0}" var="rowNum"/>

 

<apex:dataTable value="{!dataValue}" var="val" id="pgblk_tbl" >

<apex:column>
 --------------

----------------

<apex:variable var="rowNum" value="{!rowNum + 1}"/>

</apex:column>

</apex:dataTable>

 

Instead of datatable If you are using any other tags like repeat or pageblocktable will also work similarly