Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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=""/>
    </apex:outputText>

Would this work?

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

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

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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}"> 
share|improve this answer
    
Cheers Alex, appreciate the quick response. –  Daft Apr 7 at 10:02

Yes, you can do that, but like this:

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

Alternative use AND function:

rendered="{!AND(firstMethod, secondMethod)}"
share|improve this answer
    
Cheers for the answer mast0r! –  Daft Apr 7 at 10:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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