You need to sign in to do that
Don't have an account?
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!
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>
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!
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.