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 

Rerender onchange

Hi there,

 

My field "Motivo" it's a picklist field. And the options that I have in there depends Record Type.

 

I'm trying to select the Record Type = Cobrança and rerender the page.
In that way my options in field "Motivo" will appear to select.

 

So, I tried this code and I don't know what I have to do to put this in work

 

<apex:selectList value="{!case.RecordTypeId}" size="1" >
  <apex:selectOptions value="{!Cobrança}"/>
  <apex:actionSupport event="onchange" rerender="{!case.motivo__c}"/>            	
</apex:selectList> 

 

 Please someone help me.

 

Thanks,

Everton Szekeres

CP7 Marketing

Best Answer chosen by Admin (Salesforce Developers) 
Sforce ChrisSforce Chris

Everton CP7 wrote:

Hi there,

 

My field "Motivo" it's a picklist field. And the options that I have in there depends Record Type.

 

I'm trying to select the Record Type = Cobrança and rerender the page.
In that way my options in field "Motivo" will appear to select.

 

So, I tried this code and I don't know what I have to do to put this in work

 

<apex:selectList value="{!case.RecordTypeId}" size="1" >
  <apex:selectOptions value="{!Cobrança}"/>
  <apex:actionSupport event="onchange" rerender="{!case.motivo__c}"/>            	
</apex:selectList> 

 

 Please someone help me.

 

Thanks,

Everton Szekeres

CP7 Marketing


rerender is expecting a Visualforce Page Id. Like in your second example, you have to provide the Id of the element you want to rerender. You might need to provide the Id of a parent element in order to rerender a child object, depending on how you built your page.

All Answers

Everton CP7Everton CP7

Using another code I could do what I want.

 

I will show here for future doubts of someone.

 

<apex:page standardController="case">
    <apex:form >
        <apex:pageBlock title="Chamados" id="thePageBlock" mode="edit">  
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Criar Chamado" action="{!Save}"/> <apex:commandButton value="Cancelar" action="{!Cancel}" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockButtons location="top"> <apex:commandButton value="Criar Chamado" action="{!Save}"/> <apex:commandButton value="Cancelar" action="{!Cancel}" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem> <apex:outputLabel value="{!$ObjectType.case.fields.RecordTypeid.label}" for="Tipo de Registro"/> <apex:actionRegion> <apex:inputField value="{!case.RecordTypeId}" id="RecordTypeId"> <apex:actionSupport event="onchange" rerender="thePageBlock"/> </apex:inputField> </apex:actionRegion> </apex:pageBlockSectionItem> <apex:inputfield value="{!case.motivo__c}"/> {!text(now())} </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

But I still need another thing.

As I told. My field "Motivo" it's a pick list field.

And when I select a determinated option. I need some fields appears to me.

 

How I add this determinated fields when I select a determinated option in my field "Motivo"?

 

Thanks for help,

Sforce ChrisSforce Chris

Everton CP7 wrote:

Hi there,

 

My field "Motivo" it's a picklist field. And the options that I have in there depends Record Type.

 

I'm trying to select the Record Type = Cobrança and rerender the page.
In that way my options in field "Motivo" will appear to select.

 

So, I tried this code and I don't know what I have to do to put this in work

 

<apex:selectList value="{!case.RecordTypeId}" size="1" >
  <apex:selectOptions value="{!Cobrança}"/>
  <apex:actionSupport event="onchange" rerender="{!case.motivo__c}"/>            	
</apex:selectList> 

 

 Please someone help me.

 

Thanks,

Everton Szekeres

CP7 Marketing


rerender is expecting a Visualforce Page Id. Like in your second example, you have to provide the Id of the element you want to rerender. You might need to provide the Id of a parent element in order to rerender a child object, depending on how you built your page.

This was selected as the best answer
Everton CP7Everton CP7

Thanks for help Chris.

 

I tried this:

 

<apex:outputPanel rendered="{!case.motivo__c == 'Cheque devolvido'}">   	
    <apex:pageBlockSection title="Cheque devolvido" id="dados">
        <apex:inputfield value="{!case.Dados_de_retorno__c}"/>
    </apex:pageBlockSection>

 But I need to apply "on change".

 

Can you help me?

 

Thanks again.

Everton CP7Everton CP7

I change the code.

 

I put an ID and follow pratically the same thing from the first code that I did.

 

Thank you so much Chris !