Skip to main content
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
  • 136k
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,737
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
  • 151k
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,295
5 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
  • 30.6k
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
  • 151k
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,845
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
  • 151k
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

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
  • 54.2k
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

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
  • 497k
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,788
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
  • 54.2k
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
  • 151k
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
  • 93.2k
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
  • 72.1k
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

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
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
  • 497k
2 votes

Will the PDF rendered VF page can have buttons where user can click

Yes, it is possible There is an example below, that shows couple of links (as link, as buttons and as custom URL field as link type) <apex:page standardController="Account" renderAs="pdf" ...
kurunve's user avatar
  • 4,319
2 votes

How to hide a custom button in detail page

You should use rendered and disabled attribute of apex:commandButton for displaying or disabling based on formula condition. Sample code looks like this: <apex:commandButton action="{!callVFP}&...
Santanu Boral's user avatar
2 votes

Assigning VF page to Record type by rerender tag

Replace: <apex:pageBlock title="Opportunity Edit" mode="save" rendered="{if(opportunity.RecordTypeid =="012b0000000M8s5"),true,false}"> With: <apex:pageBlock title="Opportunity Edit" ...
Raul's user avatar
  • 18.8k
2 votes

Check List of List size in rendered

The syntax is correct. As I noted in my comment, a good next step is to add the expression you are trying to debug directly to the page output, like so: <p>list of List[0] size: {!...
Jason Clark's user avatar
  • 11.9k
2 votes
Accepted

Check List of List size in rendered

Assign your sublist to a variable and then access the size of the new variable. Controller: public class testPageController { public List<List<String>> listoflistofstrings {get; set;}...
gNerb's user avatar
  • 9,510
2 votes

Conditional Visualforce Component call from Visualforce Page

Looks a reasonable way to do it if the two components are substantially different. If they are nearly the same, you could avoid duplication by just conditionally rendering the parts that vary. Also, ...
Keith C's user avatar
  • 136k
2 votes
Accepted

Visualforce Conditionally Render 2 Different Fields based on 2 conditions

Sure. You've already got the pattern you need, and the conditions you have in place are entirely independent of one another - so you just need another <apex:outputPanel> with a different ...
David Reed's user avatar
  • 93.2k
2 votes
Accepted

display rendered values on the same line

This is happening because your tr's are rendering although the components within it are not rendered. To fix this, you will have to hide the tr's as well. You can do it using style attribute of tr i....
Vijay Ganji's user avatar
  • 6,656
2 votes

Help me with adding render and rerender functionalities on page

You should be able to get this working by adding the immediate="true" attribute to your <apex:actionSupport> component. With that flag set, the Visualforce runtime won't validate other ...
David Reed's user avatar
  • 93.2k

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