function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Everton CP7Everton CP7 

Rendered issue

Hi there,

 

I have a pick list field "Motivo".

And depending the option that I choose some fields appears to me.

 

The page works perfectly when I made with just one option. But when I added another options my page doesn't render.

 

<apex:outputLabel value="Motivo">
   <apex:actionRegion >
        <apex:inputField value="{!case.motivo__c}">
           <apex:actionSupport event="onchange" reRender="orçamento"/>
           <apex:actionSupport event="onchange" reRender="prestadoradeserviços"/>
      	</apex:inputField>
   </apex:actionRegion>
</apex:outputLabel>
</apex:pageBlockSection>            
    
<apex:outputPanel id="orçamento">   	
   <apex:pageBlockSection columns="1" title="Orçamento de Eventos" rendered="{!case.motivo__c == 'Orçamento de eventos'}">
	<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
   </apex:pageBlockSection>
</apex:outputPanel>
            
<apex:outputPanel id="prestadoradeserviços">   	
    <apex:pageBlockSection columns="1" title="Prestadora de Serviços" rendered="{!case.motivo__c == 'Prestadora de serviços'}">
        <apex:inputfield value="{!case.N_mero_de_Protocolo__c}"/>
	<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
    </apex:pageBlockSection>
</apex:outputPanel>

 Thanks for help.

Best Answer chosen by Admin (Salesforce Developers) 
Everton CP7Everton CP7

I figure out.

 

This will never function when you assign two IDs in the same action region.

So, I just use one ID in the action region and in the "outputpanel".

 

I'm putting what I did for future doubts.

 

	<apex:outputLabel value="Motivo">
		<apex:actionRegion >
            <apex:inputField value="{!case.motivo__c}">
     		   <apex:actionSupport event="onchange" reRender="campos"/>
         	</apex:inputField>
        </apex:actionRegion>
    </apex:outputLabel>
</apex:pageBlockSection>           
    
<apex:outputPanel id="campos">   	
	<apex:pageBlockSection columns="1" title="Orçamento de Eventos" rendered="{!case.motivo__c == 'Orçamento de eventos'}">
		<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
    </apex:pageBlockSection>
        
   	<apex:pageBlockSection columns="1" title="Prestadora de Serviços" rendered="{!case.motivo__c == 'Prestadora de serviços'}">
        <apex:inputfield value="{!case.N_mero_de_Protocolo__c}"/>
		<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
    </apex:pageBlockSection>
</apex:outputPanel>

 

All Answers

Everton CP7Everton CP7

I figure out.

 

This will never function when you assign two IDs in the same action region.

So, I just use one ID in the action region and in the "outputpanel".

 

I'm putting what I did for future doubts.

 

	<apex:outputLabel value="Motivo">
		<apex:actionRegion >
            <apex:inputField value="{!case.motivo__c}">
     		   <apex:actionSupport event="onchange" reRender="campos"/>
         	</apex:inputField>
        </apex:actionRegion>
    </apex:outputLabel>
</apex:pageBlockSection>           
    
<apex:outputPanel id="campos">   	
	<apex:pageBlockSection columns="1" title="Orçamento de Eventos" rendered="{!case.motivo__c == 'Orçamento de eventos'}">
		<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
    </apex:pageBlockSection>
        
   	<apex:pageBlockSection columns="1" title="Prestadora de Serviços" rendered="{!case.motivo__c == 'Prestadora de serviços'}">
        <apex:inputfield value="{!case.N_mero_de_Protocolo__c}"/>
		<apex:inputfield value="{!case.Subject}"/>
        <apex:inputfield value="{!case.description}" style="width: 280px !important; height: 110px !important;"/>
    </apex:pageBlockSection>
</apex:outputPanel>

 

This was selected as the best answer
ibtesamibtesam

The two page block sections you are rendering are based on one value each, so are you adding a third new value to picklist and checking the fucntionality?

 

 

"{!case.motivo__c == 'Orçamento de eventos'}"
"{!case.motivo__c == 'Prestadora de serviços'}"