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
FaridKognozFaridKognoz 

Rerender Problems

I have a visualforce page with two different outputPanels separeted from each other. Panel Nº1 has some commandLinks that rerender Panel 1 & 2. When clicking on one of those commandLinks Panel 1 rerenders as it should but, instead of panel 2 beeing rerenderd a copy of this Panel is rendered below Panel 1. Both panels are entirely different. If I change the rerender statement to just rerender one of the panels (just one) it works fine no matter which panel I rerender but when rerendering both this issue comes again.

Is this a known bug?

Thanks;

Farid

 

Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess

Please remove all Apex Form tags except one on the page.

 

Put the remaining Form tag around all of the input elements on the page. When you use multiple form tags you duplicate the viewstate, which can be costly.

 

 

If you need to control which portions of the page respond to individual buttons, ActionRegion is the way to go.

 

The key ( i believe ) is One form tab per page.

my normal method is this : 

 

<apex:page ... ><apex:form> [ the entire page ] </apex:form></apex:page>

 


 

All Answers

Ron HessRon Hess
not to my knowledge, but if you could post a small bit of code that shows the issue, we may be able to figure out what is going on.
FaridKognozFaridKognoz

Ok, this part has the first outputPanel:

 

 

<div class="module_left_left rule gutter_r"> <div class="left_left rule"> <div class="inner_list"> <apex:outputPanel id="CategoryPanel"> --> <div class="title"> Local Information</div> <ul> <apex:form id="categForm"> <apex:repeat value="{!categories}" var="i"> <li id="{!i.curr}" > <apex:commandLink action="{!changeCategory}" value="{!i.category}" rerender="ArticlePanel, CategoryPanel"> <apex:param name="cat_id" value="{!i.id}"/> </apex:commandLink> </li> </apex:repeat> </apex:form> </ul> </apex:outputPanel> </div> </div> <div><a href=" http://www.wateraid.org/uk/"><apex:image value="{!URLFOR($Resource.MarinaLibrary, 'img/banner_160x600.gif')}" styleclass="hilight" /></a></div> </div>

 

 This other part has the second outputPanel.

 

 

 

 

<div class="module_left_right rule"> <div class="left_right rule"> <div class="inner" style="overflow:auto;height:400px"> <apex:outputPanel id="ArticlePanel"> <div class="title">{!CategoryTitle}</div> <apex:form id="articleForm" styleClass="side"> <apex:repeat value="{!articles}" var="i"> <div style="background-color:#E0F3FF; border:1px solid #a1a1a1"> <apex:commandLink action="{!getArticle}" value="{!i.title}" rerender="ArticlePanel" style="font-size:12px"> <apex:param name="articleId" value="{!i.id}"/> </apex:commandLink> <br> <apex:repeat value="{!i.details}" var="j"> <apex:outputText value="{!j.Description}" escape="false"/> <br> <apex:outputText value="{!j.tel}" escape="false"/> <br> </apex:repeat> </div> <br> </apex:repeat> </apex:form> </apex:outputPanel> </div> </div> <div><a href="http://www.worldvision.org/worldvision/comms2.nsf/stable/drivepm_sponsorship?Open"><apex:image value="{!URLFOR($Resource.MarinaLibrary, 'img/banner_468x60.gif')}" styleclass="hilight" /></a></div> <br class="clear" /> <hr /> </div>

 

 Thanks in advance;

Farid

 

Ron HessRon Hess

Please remove all Apex Form tags except one on the page.

 

Put the remaining Form tag around all of the input elements on the page. When you use multiple form tags you duplicate the viewstate, which can be costly.

 

 

If you need to control which portions of the page respond to individual buttons, ActionRegion is the way to go.

 

The key ( i believe ) is One form tab per page.

my normal method is this : 

 

<apex:page ... ><apex:form> [ the entire page ] </apex:form></apex:page>

 


 

This was selected as the best answer
FaridKognozFaridKognoz

That worked wonderfully. It's a pitty visualforce has this tricky things that costs lots of hours and frustration, but on the other hand it's an advantage having this sort of communication with you guys.

Thanks Ron;

 

Ron HessRon Hess

Thank you!

 

We are working on some best-practices articles for Visualforce developers, which we will surface on the developer site soon.  

We'll be sure to include this tip!