function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shiv ShankarShiv Shankar 

How to assign dynamic Id

Hi all, i have seen standard VF page in chrome by inspect element. I have observed that in edit mode input box has id attribute(18digit id)... so i though they have implemented like this way...

----------only example--------------------

<apex:page standardController='Account' extension="xyz">
  <apex:inputField id="{act.id}" value="{act.NoOfEmployee__c}">
</apex:page>



public class xyz(){
  public xyz(ApexPages.......) {
    act = [select id, NoOfEmployee__c FROM Account WHERE Id := 
           'xyzabc'];
  }
}

 but when i assing id attribute id attribute i get's error, this attribute can not be dynamically assigned..... so how salesforce people writing code to assign dynamic IDs ? please help me...

georggeorg

The final html page you are seeing in the chrome inspector and the final html page id's are always static. Also why we are assigning id in the input field is to refer this component in other page elements, if it is dynamic the references cannot use this id field, thats why id field is made as static by sales force in input field components.

 

Let me know if you need further explanations.