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
Adam HowarthAdam Howarth 

Command Button in Dynamically rendered outputPanel - BUG?

Hey guys,

 

Ran into an issue which looks like a bug to me.

 

So I have some controls for a VF page at the top inside an output panel. The output panel is rendered based on a certain value in the custom controller I am using. Now when i try and use the command buttons inside the panel, the page just refreshes and the action method is not hit at all.

 

<apex:outputPanel rendered="{!statusCode == 200}">
<table style="width:100%;">
<tr>
<td style="vertical-align: middle;">

<apex:commandButton action="{!RedirectToReports}" title="PDF" value="PDF" ></apex:commandButton>

</td>

</tr>

</table>

</apex:outputPanel>

 

If I remove [ rendered="{!statusCode == 200}" ] then the page works correctly and the buttons do what they are meant to.

 

Is this by design or have i stumbled upon a really basic bug?

 

Cheers

Best Answer chosen by Admin (Salesforce Developers) 
Adam HowarthAdam Howarth

Hey,

 

cheers for the reponse.

 

I have changed my solution to work a bit differently and it is fine now.

 

Thanks

All Answers

Naidu PothiniNaidu Pothini
<apex:outputPanel rendered="{!IF(statusCode == 200, true, false)}">

 Not sure whether this change works or not but give a try.

 

Chamil MadusankaChamil Madusanka

Try this changes

 

<apex:outputPanel id="mainPanel">

<apex:outputPanel rendered="{!statusCode == 200}">
<table style="width:100%;">
<tr>
<td style="vertical-align: middle;">

<apex:commandButton rerender="mainPanel" action="{!RedirectToReports}" title="PDF" value="PDF" ></apex:commandButton>

</td>

</tr>

</table>

</apex:outputPanel>
</apex:outputPanel>

 Hit the Kudos button if any post helps you - Mark the answer as solution, It might help others running to into similar problem in future.

Adam HowarthAdam Howarth

Hey,

 

cheers for the reponse.

 

I have changed my solution to work a bit differently and it is fine now.

 

Thanks

This was selected as the best answer
Shiv ShankarShiv Shankar
What changes you have done ?
jvelazquezjvelazquez

Hi can you please post the solution. Even i have the same problem in my code

jvelazquezjvelazquez
Hi

I have a similar issue, In my case Command button is not displayed when I do inline editing for the any field . Please find below code

Visualforce Page:



<apex:actionRegion >

<apex:selectList value="{!selectedList}" size="1">
<apex:selectOptions value="{!listoptions}"/>
<apex:actionSupport event="onchange" reRender="Panel"/>
</apex:selectList>
</apex:actionRegion>

<apex:outputpanel id="Panel">
<apex:pageBlock rendered="{!selectedList == 'All Contacts'}">
<apex:pageBlockButtons >
<apex:commandButton action="{!saveme}" id="saveButton" value="Save" style="display: none;"/>
<apex:commandButton id="cancelButton" value="Cancel" style="display: none;"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!contact}" var="c" rows="50">

<apex:column headerValue="Job Title">
<apex:actionRegion >
<apex:outputField value="{!c.Title}">
<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" />
</apex:outputField>
</apex:actionRegion>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>

</apex:outputpanel>

I am not sure hwre I am missing out. I have gone through many blogs but couldnt find a case for inline editing

Please help me out with this