0

So I have an interesting little problem.

I have a action function in my visualforce page:

<apex:actionFunction name="handleShowChanged" action="{!handleShowChanged}" reRender="non-upload-area" />

Now the 'handleShowChanged' function returns a PageReference to either a page that shares the controller with this page or Null. So just to be clear the options for a PageReference from handleShowChanged are:

A) Null
B) Something like:

Page.myGreatPage.setRedirect(false);

My problem comes that I only want to reRender a specific section(not reload the page) if null is returned from handleShowChanged. If I keep the rerender attribute on my action function(like I have above) then the rerender will happen if null is returned - but if Page.myGreatPage is returned, the user will not load that page. If I remove the rerender then myGreatPage will get loaded, but the page will also reload if null is returned. It seems like I can only have one or the other

4
  • Try setting setRedirect as true?
    – Raul
    Oct 23 '17 at 22:28
  • Unfortunately that would cause the constructor to be run again when myGreatPage is loaded, and since myGreatPage shares a controller with the current page that's not what I'm after Oct 23 '17 at 22:33
  • I think you should try javascript remoting instead, you will have more control. - developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/… Oct 24 '17 at 0:21
  • unfortunately, since I need to have the viewstate in order to determine if a redirect is required or not, javascript remoting is not possible Oct 24 '17 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.