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
MarkL.ax269MarkL.ax269 

Summer 09 rerender Firefox vs. IE

I've run into some issues after the summer 09 update changing the behavior of commandButton/commandLink rerenders and it behaves differently in Firefox vs. IE. I've got a pageBlockTable with one column containing a "Copy" commandLink and the next column containing an inputField. Clicking the Copy link will copy the value from the inputField on that row to all other objects in the list. The commandLink then refreshes the pageBlockTable only so the copied values are displayed to the user. This much works perfectly in both Firefox and IE.

However IE goes a step further. After refreshing the pageBlockTable and displaying the copied values correctly, it then refreshes the entire page. Problem is, this causes the original queries to re-fire and all the object values are returned to their original values and the user's "copy" is wiped out before their eyes. This second refresh does not happen in Firefox.

 

<apex:pageBlockTable id="avlist" value="{!accountVariables}" var="av">
<apex:column headerValue="Copy">
<apex:commandLink value="Copy" action="{!copyFieldValue}" status="accountcopy" rerender="avlist" rendered="{!IF(contains(av.Category__c, 'Account'), 'true', 'false')}">
<apex:param name="avarid" value="{!av.Account__c}"/>
<apex:actionSupport event="oncomplete" status="accountsuccess"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="{!av.FieldID__c} {!av.Variable_Master__r.Name}">

<apex:outputPanel id="editvalue" rendered="{!IF(AND(OR(av.Type__c='Image',contains(av.Type__c, 'Text')), contains(av.Category__c, 'Account')), 'true', 'false')}">
<apex:inputField value="{!av.Value__c}"/>
</apex:outputPanel>

</apex:column>
</apex:pageBlockTable>

 

 

Message Edited by MarkL on 06-18-2009 09:17 AM
MakMak

As per the documentation:

 

commandLink

A link that executes an action defined by a controller, and then either refreshes the current page, or navigates to a different page based on the PageReference variable that is returned by the action.

 

So instead of commandLink, try using a normal link or outputLink and connect an actionSupport / actionFunction to it.

That should solve your problem. 

Message Edited by Mak on 06-18-2009 06:52 AM
MarkL.ax269MarkL.ax269
Thanks for the suggestion, but outputLink or a normal link wants to redirect somewhere and I need to execute an action without redirecting. The telling thing is I just backdated my page to v15 and everything is working as expected again, no second refresh. Something is definitely amiss with v16.

[edit] just saw your reference to the documentation, and this is one of the problems I have. What I see in the log is not what the documentation says.

commandLink
A link that executes an action defined by a controller, and then either refreshes the current page, or navigates to a different page based on the PageReference variable that is returned by the action.

What I see is a page refresh running first, then action executed, then ANOTHER refresh. My PageReference returns null to remain on the same page. And backdating to 15 fixes the problem.
Message Edited by MarkL on 06-18-2009 10:11 AM
TehNrdTehNrd

Not sure if this will make a differece but what happens if you change the copyFieldValue method to a void method.

 

 

//I assume it currenty looks like this: public PageReference copyFieldValue(){ //logic retrun null; } //What happens if you change it to this public void copyFieldValue(){ //logic }

 

 

 

MakMak

Thats another interesting thing I noticed a few days back. If an action method returns Void, it's treated as if it's returning null as PageReference. So the calling page is refreshed again.

Another thing is that if you return a String from a method, and return a valid URL as the string, the page will redirect to the new URL.

Have you guys noticed this behavior?

 

MarkL.ax269MarkL.ax269
Great idea but it didn't work. You're right, I was using a PageReference/return null method. I switched my page back to v16 and verified the problem still existed, then changed it to a void method with no return and tested again. The page still refreshes in IE and not in Firefox. This pretty much breaks one of the biggest features of VisualForce, the ability to do partial page updates.

I switched back to v15 and IE again worked as it should, rerendering only the pageBlockTable. The only problem is now the actionStatus behavior is inconsistent. But that's infinitely preferable to the refresh problem.

Case logged: 02739770
TehNrdTehNrd
Be sure to let us know what their response is. I'm still waiting to for a response on the actionStatus case I submitted.
Message Edited by TehNrd on 06-19-2009 08:53 AM
MarkL.ax269MarkL.ax269
Will do. I referenced both this thread and your actionStatus thread in the case.
XactiumBenXactiumBen

I noticed this behaviour not too long ago on one of my pages.  I think the reason is that you have an action support within your commandLink so your first refresh is because of your commandLink whilst your second refresh is because of your action support.

 

Try adding reRender="" on your action support to see if this solves the issue.

MarkL.ax269MarkL.ax269

XactiumBen wrote:

I noticed this behaviour not too long ago on one of my pages.  I think the reason is that you have an action support within your commandLink so your first refresh is because of your commandLink whilst your second refresh is because of your action support.

Try adding reRender="" on your action support to see if this solves the issue.


[edited, I spoke too soon]
 
Excellent suggestion, but it didn't work. The reason I did it the way I did was it was the only way I could get the timing of the rerender and actionStatus working, so that it both made sense to the user and actually worked the way I wanted. Though it didn't make sense from a coding point of view.  Now it rerenders immediately and apparently does NOT run the copyFieldValue method at all.  Here's what I tried:

 

  1. set page and controller to v16
  2. changed the copyFieldValue method to void
  3. moved the rerender from the commandButton to the actionSupport 
Apparently the result is that the two status messages fire in the proper order (commandButton then actionSupport), and then the rerender fires but the underlying copy method isn't run, because the value I changed is returned to the original.  Very strange.
Message Edited by MarkL on 06-22-2009 02:11 PM
Message Edited by MarkL on 06-22-2009 02:15 PM
MarkL.ax269MarkL.ax269
Actually I think the copy method is being run, just after the rerender so the results don't show.