9 votes

How should I check whether the map is empty or not in Visualforce page (API version 38.0)

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="...
Keith C's user avatar
  • 134k
6 votes
Accepted

Rendered Tags not Working on Sequential Visualforce Pages (Force.com Site)

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 ...
tugce's user avatar
  • 2,436
5 votes
Accepted

Conditional disabled fields in visualforce

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 ...
Mark Pond's user avatar
  • 22.7k
5 votes

How should I check whether the map is empty or not in Visualforce page (API version 38.0)

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 ...
Adrian Larson's user avatar
  • 148k
5 votes
Accepted

Conditional rendering of a VF Page

Yes you can. Based on your example, here's the right code: <apex:page rendered="{!AND(relatedTo.boolean1, relatedTo.boolean2)}">
Martin Lezer's user avatar
  • 7,288
4 votes
Accepted

Conditionally Showing an apex:outputPanel

If you do not have Read access to the field, it will always appear false (or perhaps null would be more accurate). As a side note, you do not need two outputPanel tags. Just use: <apex:outputPanel&...
Adrian Larson's user avatar
  • 148k
4 votes

Button Render depending on a boolean value

Your first condition is wrong if you are doing NOT in your condition correct syntax is rendered="{!!hasuser}"
Himanshu's user avatar
  • 10.4k
4 votes
Accepted

Final variable in an apex controller - Not allowed

If you want the variable to be final, you can expose the getter as a method instead of using the shorthand syntax: final String myVariable; public String getMyVariable() { return myVariable(); } ...
Adrian Larson's user avatar
  • 148k
4 votes
Accepted

How to check if map is empty in Visualforce page on rendered

Like @sfdcfox says in the comments, there's no official way to do this. If your data type was a list, the size field is exposed to visualforce, but not for sets or maps. You can get around this ...
battery.cord's user avatar
  • 8,676
4 votes
Accepted

The value 'null' is not valid for operator '>'

You can check if your collection is null before comparing its size. Note this error indicates cert.certiObj.Insured_Informations__r is null, not cert.certiObj. <apex:outputText ... rendered="{!...
Adrian Larson's user avatar
  • 148k
4 votes
Accepted

Conditional Rendering in Lightning Component with more than Aura:If(True, ELSE)

I would think the simplest way to achieve is to just write 3 different aura:if blocks. Something as below? <aura:if isTrue="{!v.selectedVal == 'Phone'}"> .. do something .. </aura:if> ...
Jayant Das's user avatar
4 votes

How to use OR operator in rendered in Visualforce in this example?

You don't need the IF function here. <apex:pageBlockSection id="onlyForLegal" rendered="{! OR( $Profile.Name = 'Legal', $Profile.Name = 'System ...
Hengky Djapar's user avatar
3 votes
Accepted

Problem with Rendered attribute behaving incorrectly. Seems to always return false when the page is loaded?

You should write: <apex:outputText rendered="{!userNeedsVerify}" value="firstRender"/>
Liron C's user avatar
  • 1,706
3 votes
Accepted

Rerender pageblock on change of picklist

You have two problems here: Check Anurag answer. Your action support need to reRender something. It's a common mistake with reRender. You can't reRender an element that was never rendered on the page ...
Fernando Gavinho's user avatar
3 votes
Accepted

Displaying fields based on picklist (apex:selectOption)

Case Sensitive (in the few cases when it does matter) gets you every time: <apex:actionSupport event="onChange" action="{!updateFieldVisibility}" reRender="editForm" /> should be <apex:...
Eric's user avatar
  • 53.7k
3 votes
Accepted

Rendering Hyperlink in VF page

Your markup is fine. Your merge logic, however, violates a basic axiom of Boolean logic: You can always replace IF(condition, true, false) with simply condition. In your case, it should be: <...
Adrian Larson's user avatar
  • 148k
3 votes
Accepted

How to display the default image if there is no attachment image

Using the rendered attribute may help in this case. I have wrapped your img tag in an outputPanel so there is a processed item to attach a rendered attribute to. Use the size attribute of a list to ...
Richard Durrant's user avatar
3 votes
Accepted

Usage of rendered={!! Value} in output panel component

The {! } is the merge field syntax which gets the value from the controller. The other ! is used to negate a Boolean value. So, in your example, rendered="{!!movingFavoritesBetweenLists}" means that ...
martin's user avatar
  • 12.5k
3 votes

Visualforce rendering woes - layout is broken when using a parent <apex:outputPanel>

Unfortunately if the Section items are not rendered the first time then they will not be rendered properly. Also note that <apex:pageBlockSectionItem> components can't be rerendered; ...
Eric's user avatar
  • 53.7k
3 votes
Accepted

Is it possible to prevent unused Visualforce Components from using View State?

You could choose to render your page dynamically. It's not normally recommended because... reasons. Dynamic Visualforce components are not intended to be the primary way to create new Visualforce ...
sfdcfox's user avatar
  • 468k
3 votes
Accepted

Visualforce format an output number depending on decimal value, if decimal is zero then just display the number

This is the easiest trick. Multiply the value with 100 and then use MOD function to find the remainder upon diving 100. Basically, if value is 10.00 then it should be 10.00*100 = 1000, So MOD(1000,...
Santanu Boral's user avatar
3 votes
Accepted

Conditionally Render Apex:Column

Visualforce expressions don't support a syntax like what you seem to need: <apex:column headerValue="List Price" rendered="{!ISFIELDPOPULATEDINANY(listQLI2, List_Price__c)}"> <apex:...
David Reed's user avatar
  • 90.9k
2 votes

Render condition error throws

Oh , I got my error. Corrected it as below. rendered="{!IF(SelectedSize > 0 && (counter!=0) , true, false)}"
Testing_SFDC's user avatar
  • 2,930
2 votes
Accepted

Display the data if "quantity" is not = 0. Using multi map

After updating the question with the map declaration, I can see that your innerKey represents a list, so you need to check it's size and use the rendered attribute: <apex:repeat value="{!...
Boris Bachovski's user avatar
2 votes
Accepted

Password protected Visualforce Page rendered as PDF

I'm not aware of any flags that can be set on the render engine to establish any PDF native security settings to password protect it at the time it's rendered. You might want to check the Flying ...
crmprogdev's user avatar
  • 40.8k
2 votes

Based on picklist selection, how to display corresponding pageblock on vf page- can anyone check this

The likely reason you are having trouble is because when the page is initially rendered, both pageBlocks aren't shown because {!employment} is neither sal or busi. Hence the DOM is never created for ...
cropredy's user avatar
  • 67.6k
2 votes

Rerender pageblock on change of picklist

You may have to modify the action support with following syntax: <apex:actionSupport event="onchange" rerender="sec1" />
Anurag Bhardwaj's user avatar
2 votes
Accepted

I want to render one page block section on the page to certain user only.

That is strange, but my best guess is that the Name field is actually a composite field which gets some magic treatment in the backend. I notice that both FirstName and Lastname work, so perhaps you ...
RenegadeCoder's user avatar
2 votes
Accepted

How to place an IF statement in a title attribute on a Visualforce page

Formulas in Visualforce start with {!, and end with }. Individual fields do not start with !; using ! inside the formula works as the not operator. {!if(PP_IsOwner, $Label.D1, $Label.D2)}
sfdcfox's user avatar
  • 468k
2 votes

reRender value determine

The root cause of the issue is you are using two form tag on the page . The action function Rerender does not work well with two forms on the page ,hence the solution would be to use only one form ...
Mohith Shrivastava's user avatar

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