+ Start a Discussion
Edwin VijayEdwin Vijay 

Problems with page rerendering!!!!

Hi All,

 

I have been facing issues with rerendering of outputpanels..

 

 

<apex:selectRadio value="{!country}"> <apex:actionSupport event="onclick" reRender="emailservices"/> <apex:selectOptions value="{!items}"/> </apex:selectRadio> <apex:outputpanel id="emailservices" rendered="{!country== 'YES'}"> Select the Email service to be used &nbsp;&nbsp;&nbsp; <apex:selectList value="{!emailservice}" size="1"> <apex:actionSupport event="onchange" reRender="emailaddress" /> <apex:selectOptions value="{!servicenames}"/> </apex:selectList> <br/> <br/> </font> <apex:outputpanel id="mailserv" id="emailaddress" rendered="{!emailservice != NULL}" > Select the Email address to be used &nbsp; <apex:selectList value="{!mailaddress}" size="1" > <apex:selectOptions value="{!mailaddresslist}"/> </apex:selectList> </apex:outputpanel> </apex:outputpanel>

 Am i going wrong anywhere...

 

Thanks in advance

 

 

Best Answer chosen by Admin (Salesforce Developers) 
XactiumBenXactiumBen

The reRender attribute only rerenders the output panel's children.  With this in mind, trying to reRender an output panel that is not being rendered will not do anything.

 

Try wrapping your output panels in another output panel and reRendering that:

 

<apex:selectRadio value="{!country}"> <apex:actionSupport event="onclick" reRender="emailServicesWrapper" /> <apex:selectOptions value="{!items}"/> </apex:selectRadio> <apex:outputPanel id="emailServicesWrapper"> <apex:outputpanel id="emailservices" rendered="{!country== 'YES'}"> Select the Email service to be used &nbsp;&nbsp;&nbsp; <apex:selectList value="{!emailservice}" size="1"> <apex:actionSupport event="onchange" reRender="emailAddressWrapper" /> <apex:selectOptions value="{!servicenames}"/> </apex:selectList> <br/> <br/> <apex:outputPanel id="emailAddressWrapper"> <apex:outputpanel id="emailaddress" rendered="{!emailservice != NULL}" > Select the Email address to be used &nbsp; <apex:selectList value="{!mailaddress}" size="1" > <apex:selectOptions value="{!mailaddresslist}"/> </apex:selectList> </apex:outputpanel> </apex:outputPanel> </apex:outputpanel> </apex:outputPanel>

 

All Answers

XactiumBenXactiumBen

The reRender attribute only rerenders the output panel's children.  With this in mind, trying to reRender an output panel that is not being rendered will not do anything.

 

Try wrapping your output panels in another output panel and reRendering that:

 

<apex:selectRadio value="{!country}"> <apex:actionSupport event="onclick" reRender="emailServicesWrapper" /> <apex:selectOptions value="{!items}"/> </apex:selectRadio> <apex:outputPanel id="emailServicesWrapper"> <apex:outputpanel id="emailservices" rendered="{!country== 'YES'}"> Select the Email service to be used &nbsp;&nbsp;&nbsp; <apex:selectList value="{!emailservice}" size="1"> <apex:actionSupport event="onchange" reRender="emailAddressWrapper" /> <apex:selectOptions value="{!servicenames}"/> </apex:selectList> <br/> <br/> <apex:outputPanel id="emailAddressWrapper"> <apex:outputpanel id="emailaddress" rendered="{!emailservice != NULL}" > Select the Email address to be used &nbsp; <apex:selectList value="{!mailaddress}" size="1" > <apex:selectOptions value="{!mailaddresslist}"/> </apex:selectList> </apex:outputpanel> </apex:outputPanel> </apex:outputpanel> </apex:outputPanel>

 

This was selected as the best answer
Edwin VijayEdwin Vijay

Thanks a lot.. thatworked great..

 

I have one more problem.. I need to have two conditions in the rendered attribute 

 

eg: rendered="{!emailservice != '--None--'} || {!emailservice != NULL}" ... I this syntax correct, if yes the rendering doesnt work for the condition

 

Thanks in advance

XactiumBenXactiumBen

The || has to be included in the conditions (I also think && would work better):

 

rendered="{!emailservice != '--None--' && emailservice != NULL}"

 

Edwin VijayEdwin Vijay
You're right.. Thanks for the help