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="...
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 ...
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)}">
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 ...
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&...
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}"
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(); }
...
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 ...
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="{!...
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>
...
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 ...
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; ...
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"/>
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 ...
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:...
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:
<...
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 ...
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,...
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:...
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 ...
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" />
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 ...
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)}
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"
...
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}&...
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 ...
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" ...
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: {!...
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;}...
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, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
rendered × 151visualforce × 119
apex × 45
rerender × 22
conditional × 11
pdf × 8
controller × 7
visualforce-component × 7
outputpanel × 7
outputtext × 6
map × 5
email-template × 4
picklist × 4
pageblocktable × 4
repeat × 4
selectoption × 4
pageblocksection × 4
custom-button × 3
dynamic-visualforce × 3
actionfunction × 3
commandbutton × 3
selectlist × 3
actionsupport × 3
if × 3
boolean × 3