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

Adding True False Condition To Apex:actionFunction "ReRender"



I have a scenario where I have an apex:actionFunction. This actionFunciton rerenders outputpanels in my visualforcve page.

I with to only rerender the outputPanel's based on a boolean value from my controller. If after I call my function my boolean value is true I want to rerender specific panels. If not I don't want to rerender them.


I tried this with the following but it does not seem to work correctly

reRender="{!if(priorformProcessed, 'panel1, panel2', 'testFalse')}"


The actionFunction exists in panel 1.  "TestFalse" is always rerendered no matter if my boolean is true (and true in my view state). 



Do you know if there is a way of dynamically providing which panels to ReRender similar to what I'm trying to do above?


I tried to use a string variable which I set in my controller to define which panels to rerender but so far I have not got this to work either (although it may be a possible approach).


Any advice/suggestions on this would be good.




I am stuck with a similiar issue, but I am rerendering an outputtext. I am trying to set the flag to true or false ina controller and trying to pass it to the page, I see the flag is being set but not getting passed to page.


Take a look  which I have tried may be you can fix it and get it working.Let meknow if you are able to fix it

Shiv ShankarShiv Shankar

Since your output panel is rendered according to certain condition. let it be reRender everty time, if your controller makes the value true than it will render otherwise it will not reRender.



Shiv ShankarShiv Shankar
Hi salesRed,

If we reRender it , every time it will not rendered bcz one of the condition became false.

i think if we replace AND operator with OR operator it will full fill your requirement
Like :
"renrded={!if(x==true || y==true)}">


         reRender="{!if(true, 'panel1, panel2', 'testFalse')}"     

         this reRenders 'panel1' and 'panel2'

If I try

         reRender="{!if(false, 'panel1, panel2', 'testFalse')}"

         this reRenders 'testFalse'


In my view state my boolean variable "priorformProcessed" does display the correct required "true" or "false" value.
It's as if in my if statement in my actionFunction (or commandButton which I've tried also) it always takes this boolean to be false or null. Does it not bind correctly, or can binding of this type not be performed?  

If I use an outputText on my page it displays the correct value.


I can look into the "rendered" options as you have suggested Shiv Shankar however I think I may not be able to get all scenarios I require within this to work.


Thanks again for your help & if you/anyone has any further thoughts on the above binding question you can let me know.