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
Sure@DreamSure@Dream 

Literal Value is Required for attribute id in <apex:outputpanel>

Hi All,

I am having visualforce code like following:
I want to provide a dynamic id to the outputpanel and want to rerender particular outputpanel alone onclick of a commandLink as shown.
<apex:repeat value="{!listOfRecords}" var="rec">
         <apex:outputpanel id="{!rec.Id}">
                   <apex:commandLink rerender="{!rec.Id}" ......../>
          </apex:outputpanel>
</apex:repeat>

Its giving me following error, if i try to keep {!rec.Id} as the id for outputpanel:
  "Literal Value is Required for attribute id in <apex:outputpanel>"

And If I give {!rec.Id} as rerender attribute for CommandLink, its giving following error:
Unknown property rec

Could you guys please help me to solve this or by providing any work arounds?


Thanks in advance:)
Best Answer chosen by Sure@Dream
Sure@DreamSure@Dream
Hi ,

I am able to solve this by doing as follows:

<apex:repeat value="{!listOfRecords}" var="rec">
         <apex:outputpanel id="panelId">
                   <apex:commandLink rerender="panelId" ......../>
          </apex:outputpanel>
</apex:repeat>

No need to use dynamic ids for this.

All Answers

Ramu_SFDCRamu_SFDC
Can you elaborate the controller code for listofrecords ?
Sure@DreamSure@Dream
Hi ,

I am able to solve this by doing as follows:

<apex:repeat value="{!listOfRecords}" var="rec">
         <apex:outputpanel id="panelId">
                   <apex:commandLink rerender="panelId" ......../>
          </apex:outputpanel>
</apex:repeat>

No need to use dynamic ids for this.
This was selected as the best answer