+ Start a Discussion
Mitesh SuraMitesh Sura 

Retrive id within apex:repeat tag

I am doing simple alert and the id in the alert does not match with actual id of "prodSalePrice" input field. I have highlighted the difference ( 7 vs 9) above.

Any clue why the id does not match. I think {!$Component} tag is not used correctly
<apex:repeat value="{!fieldSet}" var="f">
                                
   !-- Product quantity -->     
   <apex:column headerValue="{!f.Label}" rendered="{!f.fieldPath=='Quantity'}" width="50px"> 
      <apex:inputText id="prodQuantity" value="{!wP.quantity}" onchange="alert('{!$Component.prodSalePrice}');" />
   </apex:column>   
       
   /// Above alert: j_id0:form:j_id233:j_id241:j_id242:sectionProducts:0:j_id252:7:prodSalePrice ///
			        			
   <!-- Product sale price -->
   <apex:column headerValue="{!f.Label}" rendered="{!f.fieldPath=='UnitPrice'}" width="100px">
      <apex:inputText id="prodSalePrice" value="{!wP.salePrice}" />
   </apex:column>   

   /// Actual id: j_id0:form:j_id233:j_id241:j_id242:sectionProducts:0:j_id252:9:prodSalePrice ///

</apex:repeat>


claperclaper
you must likely will need to use jquery for this, and a hidden field in one of you columns.
Mitesh SuraMitesh Sura
Hi Claper,

I was thinking the same as well. in fact, I started to work on it. If you do not mind can you please post an example?

I have field set that I am using in apex:repeat  Lets assume it has discount, sale price, and total price. What I like is, when user changes discount or sale price, total price should be updated.