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
jonathanrico.jonathanrico. 

Help.. Assigning Dynamic Ids to panel inside component.

Hello everyone, I appreciate any help with this issue.

I will like to know if it's possible to assign a dynamic id to a panel inside a custom component. For example:

Code:
<apex:component>
<apex:attribute name="OPid" description="This is the id that will be assigned to the panel" type="String" required="true"/>
             
           <apex:outputPanel id="{!Opid}"></apex:outputPanel>

</apex:component>


If I do it this way, I get thrown an Illegal argument exception, is it possible to assign this value to the id property of the outpanel?
Thanks in advance.

Jonathan.
Best Answer chosen by Admin (Salesforce Developers) 
modoleamodolea
hi Jonathan
 
Try something like this:
 
Code:
<apex:outputPanel id="myId_{!Opid}"></apex:outputPanel>

 
regards
adrian

All Answers

modoleamodolea
hi Jonathan
 
Try something like this:
 
Code:
<apex:outputPanel id="myId_{!Opid}"></apex:outputPanel>

 
regards
adrian
This was selected as the best answer
jonathanrico.jonathanrico.
Awesome, worked perfect. thanks!