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
DrawloopSupportDrawloopSupport 

Problem rerendering outputPanel with dynamic rendered value

Using outputPanel, actionRegion, and actionSupport as shown below, I cannot get the outputPanel to be rendered="true" when it should be. Using System.debug, my code is working accurately.

 

 

<apex:actionRegion immediate="true"> <apex:selectRadio value="{!selectedOption}" id="opt" layout="pageDirection"> <apex:selectOptions value="{!options}" /> <apex:actionSupport event="onchange" rerender="li" /> </apex:selectRadio> <apex:outputPanel rendered="{!showOption1}" id="li"> <!-- HTML and apex elements here --> </apex:outputPanel> </apex:actionRegion> public boolean showOption1 { get; set; } public custom_object__c getObj() { // *** logic to change boolean showOption1 *** return object; }

 

 Does anyone have any ideas as to what I may be doing wrong?

 

Thanks!

 

TehNrdTehNrd

You need to peform the rerender on a parent object of the object you want to render. Try this:

 

 

<apex:actionRegion immediate="true"> <apex:selectRadio value="{!selectedOption}" id="opt" layout="pageDirection"> <apex:selectOptions value="{!options}" /> <apex:actionSupport event="onchange" rerender="li" /> </apex:selectRadio> <apex:outputPanel id="li"> <apex:outputPanel rendered="{!showOption1}"> <!-- HTML and apex elements here --> </apex:outputPanel> </apex:outputPanel> </apex:actionRegion>

 

 

 

DrawloopSupportDrawloopSupport
I did try that, but perhaps I did something wrong when I tried it. It could also be an issue that I have an actionSupport on a previoius object that is rerendering the selectRadio. I will continue to dig. Thanks, TehNrd!
TehNrdTehNrd
Ah, I didn't see immediate="true" attribute. Try removing this and see what happens.
Message Edited by TehNrd on 06-08-2009 04:42 PM
DrawloopSupportDrawloopSupport

I removed immediate="true" from actionRegion and created a secondary outputPanel inside the original outputPanel (outside has id, inside has dynamic rendered value). This did not work.

 

I left off immediate="true" on actionRegion and added action="{!test}" to actionSupport that set the dynamic rendered value to true. This seems to be working now.

 

Added immediate="true" on actionRegion - still works.

 

I think the combination of the nested outputPanels and the action="{!test}" on the actionSupport made this work for me. Thanks for your help!

DrawloopSupportDrawloopSupport
One more question. I have a selectList that rerenders a selectRadio which rerenders the outputPanel. Before the selectList rerenders the selectRadio, the rerendering of the outputPanel by the selectRadio works properly. But after the onchange event on the selectList, the selectRadio fails to rerender the outputPanel on any onchange event. Could the rerendering of the selectRadio be removing the actionSupport child?
DrawloopSupportDrawloopSupport

Nevermind the previous question. That is not the case. However, I am getting a strange error in the debugger on my selectRadio:

 

Validation Error: Value is not valid

 

I'm not sure why this would happen. I don't have the field set to required nor have I set any special validation anywhere on the page.