43

This is just a syntax issue, your condition will work if you make a few small changes Change <!-- doesn't work, this is apex, not a formula as required --> <apex:pageBlockTable ... rendered="contacts.size()>0"> To <apex:pageBlockTable ... rendered="{!contacts.size>0}">


11

You can use standard functions in the rendered statement <apex:outputLink value="/page" styleClass="btn" id="register" rendered="{!IF(AND(Category__c == 'data1',article.Custom_URL == ''), TRUE, FALSE)}">Register</apex:outputLink>


9

<apex:outputPanel id="opformofauth" style="width:100%" rendered="{!lstPersonWrapper.size!=0}"> </apex:outputpanel>


9

{!} is merge syntax Adding parentheses may help visualize what is happening in your evaluations. true and not true == false <apex:outputLink rendered="{! (isTrue && !isTrue) }"> true and not not true (true to false and then back to true) == true <apex:outputLink rendered="{! (isTrue && !!isTrue) }">


9

The below solution does not work reporting this compile error when the page is saved: Unknown property 'cons.size' If cons is a map field of the controller, I would expect this to work: rendered="{! cons.size > 0 }" as a reference to cons is a reference to the map keys.


8

I would try to use the function ISBLANK to determine if the list is blank or null: <apex:outputPanel id="opformofauth" style="width:100%" rendered="{!NOT(ISBLANK(lstPersonWrapper))}"> ... </apex:outputpanel> Additionaly you can check whether the list has any enties: <apex:outputPanel rendered="{!NOT(...


7

Yes, you just need to wrap the output in something you can render selectively such as an outputpanel. <ul data-role="listview" data-filter="false"> <apex:repeat value="{!Proposals}" var="item"> <apex:outputPanel rendered="{!item.LineCount > 0}"> <li> <a href="{!$Page.aa_rg_jm_proposal}?id=...


7

<apex:pageBlockSection columns="1" id="Test" > <apex:inputcheckbox value="{!test.Same_Address__c}" label="Same as Above">//removed selected=true <apex:actionSupport event="onchange" rerender="Test" /> </apex:inputcheckbox> <apex:outputPanel rendered="{!NOT(test.Same_Address__c)}"> <apex:inputField value="{!test....


7

You can try to pack your jQuery code to the function and execute this function only if the panel is rendered: <script> function doStuff(){ j$("[class$=costType]").find('input').bind("change", function(event, ui) { if(j$(this).val()=='Value'){ j$("[class$=typeA]").closest('tr').css('display','none'); j$("[class$=...


7

Update (2017) The trick below is good for 90% of cases, especially if you need a placeholder to which rerender might eventually have to inject something. But it can cause problems if you render VF as PDF and you're using this conditional rendering to hide table rows; inside <apex:repeat> for example. (Of course best would be to filter the data in a ...


6

Try to add a border to the @page css rule (the page area includes the boxes laid out on that page). Because of the page area the border will be drawn on each generated page: <apex:page renderAs="pdf" applyHtmlTag="false" showHeader="false" cache="true" readOnly="true"> <head> <meta http-...


6

Please make sure that you convert the number, opportunity.amount, to string using the TEXT() function so that the concatenation can be done. <apex:outputText value="{!IF(opportunity.Amount < 0, '$(' + TEXT(opportunity.Amount) + ')', '$' + TEXT(opportunity.Amount))}"></apex:outputText>


6

In general, I would suggest to keep the logic at the controller layer, as opposed to the view layer. I would do something like this On VF <apex:outputText value="{!myOppAmount}"/> In Controller. (Assuming you have an opportunity property already) public string getMyOppAmmount(){ string s = (this.Opp.Amount > 0) ? '$' + this.Opp.Amount : '$(...


6

I've been able to make things like this by simply doing this: render="{!HasTeamMeber && ENT_ED_LIHTC__c.recordtype.name =='Standard Deal'}" At least it seems to work fine with a page I was working on. Another way would be to have a Boolean method in your controller that returns true or false and put the logic there.


6

I've played around with your code a bit then I remembered you wrote "Refreshing the page will update the rendering to be correct, however the refreshing is manual." It happens because of caching mechanism. If you set cache="false" on your nextpage it will render correctly each time. In Force.com sites caching defaults to true. You can read manual from here. ...


5

Generally your code is almost clear. If you can not see labels on the page that means that your formula condition just returns false. Try to figure out why it is happening. Make some debug outputs in HasTeamMember. Maybe TeamMembers size is 0? The simplest thing what you can do is to output these two variables on the visualforce page to check it content: ...


5

You can bind a "tabStyle" to the page, which causes the color theme/icon to match the named tab or object tab (Custom__Tab or CustomObject__c). However, this value cannot be dynamic, so you may need to use a template page or component that contains the logic you want to encapsulate for each object individually, then include that page in two other pages that ...


5

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}">


5

Without getting terribly technical, Visualforce is essentially implemented as JSP; the Visualforce markup is compiled into JSP and run by the Java runtime that renders all of salesforce. The reason why you don't see hidden elements is because the html is rendered server-side, then delivered to the client JavaScript, which basically drops the compiled code ...


5

You can't provide parameters to a function that way (readOnlyField(f)), so you would indeed need getters. The closest approximation would be a map: public Map<String, Boolean> readOnlyField { get; set; } // ... // readOnlyField = new Map<String, Boolean> { 'Name' => false /* , ... */ }; Since missing keys will cause a crash, you'll have to ...


5

It appears that you're trying to get VF to render disabled="true" when the current user doesn't have a profile name of 'Account Manager'... A little background: {! } is merge syntax, where the VF engine will evaluate the statements within the brackets during it's render of the data. What you're probably seeing in your rendered markup is something along the ...


5

I have had success with this approach: rendered="{!NOT(myMap.empty)}" Note you can always replace IF(condition, true, false) with simply condition. The statements are functionally equivalent, but the former is redundant and bloats compile size.


5

Yes you can. Based on your example, here's the right code: <apex:page rendered="{!AND(relatedTo.boolean1, relatedTo.boolean2)}">


4

Something has simple has this could work: <apex:page standardController="Opportunity" showHeader="false" renderAs="pdf"> <apex:pageblocktable value="{!Opportunity.bucketRate__r}" var="b" title="Bucket Rate Factoring Fee" > <apex:column value={!b.levelname__c} /> <apex:column value={!b.lowdays__c} /> <apex:...


4

You just need to use double '!!'. It looks funky, but it accomplishes what you are looking for rendered="{!!selectedNameIsContact}" EDIT As pointed out by @sfdcfox, you could also use rendered="{!not selectedNameIsContact}" Also pointed out by @Ralph, you could also use {!selectNameisContact == false}


4

Yes, you can do that, but like this: rendered="{!firstMethod == true && secondMethod == true}" Alternative use AND function: rendered="{!AND(firstMethod, secondMethod)}"


4

It's not terribly clear what the issue is. My best guess is that there is something wrong with your DOM and that's causing your rerender to break. Going off of your snippet you posted, I refactored the VF to clean up the DOM some, and changed the object to Account and used standard Account fields just so that it would work in my sandbox. Also, I tested it ...


4

I would move your logic into the controller. You have much more control this way. You can use this one property to set the visibility of many components on your page and keeps the logic in the controller layer as opposed to the view layer, which is always a best practice. Something like this public boolean getIsVisible(){ string pId = UserInfo....


4

There are several questions I see here. To see the label: change the inputfield to: <apex:pageblocksectionitem> <apex:outputlabel value="{!$ObjectType.YOUR_OBJECT.fields.Contact_First_Name__c.label}" /> <apex:inputField value="{!test.Contact_First_Name__c}" /> </apex:pageblocksectionitem> To make the tickbox by default ...


4

You can do this as: <apex:pageBlockTable ... rendered="{!IF(contacts.size>0,'true','false')"> On visualforce page we can check conditions by:{!IF(condition,InTrueCondition,IfConditionIsFalse)} Same as List size can be checked as: <apex:pageBlockTable value="{!contacts}" var="ct" rendered="{!IF(contacts.size>0,'true','false')"> ...


Only top voted, non community-wiki answers of a minimum length are eligible