On visualforce page I have a selectlist. If A, B , or C is selected. I want to show the second pageBlockSectionItem. If it's not one of those values I want to show the first pageBlockSectionItem section.

The problem I am having is when I select A the second pageblockSectionItem shows, but it doesn't show if I select B or C.

I would like the second pageblockSectionItem section to show also if A, B or C is selected It seems to only work correctly if A is selected only.


<apex:actionFunction name="manageType2" action="{!manageType}" 
rerender="pbSecCharges" status="typeStatus" immediate="true">
    <apex:param name="dealType" value="" assignTo{!SelectedType}"/>

<apex:selectList value="{!Opty.Deal_Rent__c}" required="true"  
 id="ddlRentType" onchange="manageType(this);" size="1" >
    <apex:selectoption itemLabel="A" itemValue="A"></apex:selectoption>
    <apex:selectoption itemLabel="B" itemValue="B"></apex:selectoption>
    <apex:selectoption itemLabel="C" itemValue="C"></apex:selectoption>
    <apex:selectoption itemLabel="D" itemValue="D"></apex:selectoption>

<apex:pageBlockSectionItem rendered="{!Show}" id="itemRealEstate">
   <apex:inputField value="{!Opty.Permanent_Tax__c}" id="txtRealEstate" 
    required="true" />
   <apex:inputField value="{!Opty.Permanent_Tax_Notes__c}"/>

<apex:pageBlockSectionItem   rendered="{!!Show}">
     <apex:outputLabel value="$0.00"/>
     <apex:inputField value="{!Opty.Permanent_Tax_Notes__c}"/>

Apex Class

public class RentExtension{
public string SelectedType {get;set;}
public Boolean Show {get;set;}    

public void manageType() {
Show = show(SelectedType);

private static boolean show(string dealType) {
boolean show = false;
 if(dealType != null){ 
    show = (dealType != Utility.DEAL_A || dealType != Utility.DEAL_B 
             ||dealType != Utility.DEAL_C);
return show;        
  • Does the element with id pbSecCharges contain both the pageBlockSectionItem?
    – Saroj Bera
    Apr 17, 2018 at 4:37
  • yes it does contain both
    – user58
    Apr 17, 2018 at 4:44

1 Answer 1


When you select ModifiedGross or Standard the expression showRealEstateTax = (dealRentType != Utility.DEAL_GROSS || dealRentType != Utility.DEAL_MODIFIEDGROSS || dealRentType != Utility.DEAL_STANDARD); evaluates to true.

And in your VF page, you have used rendered="{!!ShowRealEstate}" to show the second-page block section.

So when you select ModifiedGross or Standard ShowRealEstate becomes true and the expression {!!ShowRealEstate} evaluates to false and the apex:pageBlockSectionItem doesn't render.

  • I don't quite understand. Is what you mentioned a solution or question? what do i need to change to make it work?
    – user58
    Apr 17, 2018 at 6:53
  • If I select Gross . It works correctly as I mentioned. It should still work if I select ModifiedGross or Standard. I don't see how it still works for one and not the others.
    – user58
    Apr 17, 2018 at 7:01
  • I explained the reason, why it is not rendering. You have to update the logic.
    – Saroj Bera
    Apr 17, 2018 at 9:33
  • Thanks but that didn't help me. Can you provide a example of what in logic i need to change? I havent figured it out yet
    – user58
    Apr 20, 2018 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .