Can I pass a second method into the rendered attribute of the following apex element?

    <apex:outputText rendered="{!(firstMethod == true)}">           
        <img class="refresh_btn" src="{!URLFOR($Resource.Images, 'images/icon_refresh.png')}" alt=""/>

Would this work?

    <apex:outputText rendered="{!(firstMethod == true)} && {!(secondMethod == true)}">          
        <img class="refresh_btn" src="{!URLFOR($Resource.Images, 'images/icon_refresh.png')}" alt=""/>

So both firstMethod and secondMethod must return true for the element to render.


Yes you can, although your syntax is a little off. The following should work:

<apex:outputText rendered="{!(firstMethod == true) && (secondMethod == true)}"> 

Which you should be able to reduce to:

<apex:outputText rendered="{!firstMethod && secondMethod}"> 
  • Cheers Alex, appreciate the quick response. – Daft Apr 7 '14 at 10:02

Yes, you can do that, but like this:

rendered="{!firstMethod == true && secondMethod == true}"

Alternative use AND function:

rendered="{!AND(firstMethod, secondMethod)}"
  • Cheers for the answer mast0r! – Daft Apr 7 '14 at 10:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.