+ Start a Discussion
Lago S.p.a.Lago S.p.a. 

Record Type and Visualforce

Hi, I have a problem with my visualforce. I would like to show a particular panel if I choose a record type, initially it works, but when I try to click save button, the records of the contract are not saved and the page remains as I left it.
Here' s my visualforce code:

<apex:page StandardController="Contract">
<apex:variable value="{!Contract.Account}" var="Account"/>
<apex:variable value="{!Contract.RecordType}" var="recordtype"/>
  <h1>Contract</h1>
  <apex:define name="Header">
         <apex:sectionHeader title="{!$ObjectType.Contract.label}" subtitle="Nuovo Contratto"/>
             <apex:form >
                <apex:inlineEditSupport event="ondblClick">
                <apex:pageBlock mode="view">
                    <apex:pageBlockButtons location="both">
                        <apex:commandButton value="Save" action="{!save}"/>
                        
                        <apex:outputPanel id="ContrattoProgettazione">
                        <apex:commandButton value="Contratto Progettazione" action="{! URLFOR($Action.Contract.Contratto_Progettazione, Id)}" rendered="{!Contract.accordo_prog__c=='Si'}"/>
                        <apex:inputField value="{!Contract.RecordTypeId}"/>
                        </apex:outputPanel>
                    </apex:pageBlockButtons>
                    <apex:actionRegion >
                 <apex:outputPanel id="Contratto_Shop" rendered="{!Contract.RecordTypeId = '01230000000EeSO'}">
                    <apex:pageBlockSection id="Shop1" columns="2" title="Dettagli Contratto Shop" >
                        <apex:inlineEditSupport event="ondblClick">
                            <apex:outputField value="{!Contract.ContractNumber}" />
                            <apex:inputField value="{!Contract.AccountId}" required="true"/>
                            <apex:inputField value="{!Contract.Tipo__c}" required="true"/>
                            <apex:outputField value="{!Contract.agente__c}"/>
                            <apex:inputField value="{!Contract.Stato__c}" required="true"/>
                            <apex:outputField value="{!Contract.customercode__c}"/> 
                            <!--<apex:inputField value="{!Contract.Status}"/>-->
                            <apex:outputField value="{!Contract.PrimoContratto__c}"/>
                            <apex:inputField value="{!Contract.SpazioEsposizione__c}" required="true"/>
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>
                    <apex:pageBlockSection id="Shop2" columns="2" title="Condizioni" >
                        <apex:inlineEditSupport event="ondblClick">
                        <apex:inputField value="{!Contract.Type__c}" required="true"/>  
                        <apex:inputField value="{!Contract.contract_sign_date__c}"/>
                        <apex:inputField value="{!Contract.discount__c}" required="true"/>
                        <apex:inputField value="{!Contract.StartDate}"/>
                        <apex:inputField value="{!Contract.ChiaviInMano__c}"/>
                        <apex:inputField value="{!Contract.endContractDate__c}"/>
                        <apex:inputField value="{!Contract.ServizioOutlet__c}"/>
                        <apex:inputField value="{!Contract.addebito_spese__c}"/>
                        <apex:inputField value="{!Contract.data_start_add_spese__c}"/>
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>
                    <apex:pageBlockSection id="Shop3" columns="2" title="Budget" >
                        <apex:inlineEditSupport event="ondblClick">
                        <apex:inputField value="{!Contract.Budget_2016__c}"/>
                        <apex:inputField value="{!Contract.target_2016__c}"/>
                        <apex:inputField value="{!Contract.Budget_2017__c}"/>
                        <apex:inputField value="{!Contract.target_2017__c}"/>
                        <apex:inputField value="{!Contract.Budget_2018__c}"/>
                        <apex:inputField value="{!Contract.bdg_rinnovo_2016__c}"/>
                        <apex:inputField value="{!Contract.budget_2019__c}"/>
                        <apex:inputField value="{!Contract.rinnovo_2017__c}"/>
                        <apex:inputField value="{!Contract.sconto_prec__c}"/>  
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>
               </apex:outputPanel>
               <apex:outputPanel id="Contratto_Discover" rendered="{Contract.RecordTypeId ==‘012a0000001W9qA'}">
                    <apex:pageBlockSection id="section1" columns="2" title="Dettagli Contratto Discover" >
                        <apex:inlineEditSupport event="ondblClick">
                            <apex:inputField value="{!Contract.AccountId}"/>
                            <apex:inputField value="{!Contract.ContractNumber}" />
                            <apex:inputField value="{!Contract.Type__c}" required="true"/>
                            <apex:inputField value="{!Contract.Tipo__c}" required="true"/> 
                            <apex:inputField value="{!Contract.agente__c}"/>
                            <apex:inputField value="{!Contract.Status}" required="true"/>
                            <apex:inputField value="{!Contract.accordo_prog__c}" required="true"/>
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>
                        
                    <apex:pageBlockSection id="section2" columns="2" title="Condizioni Commerciali">
                        <apex:inlineEditSupport event="ondblClick">
                            <apex:outputField value="{!Contract.invio_lett_intenti__c}"/>
                            <apex:outputField value="{!Contract.ricez_lettera_intenti__c}" />
                            <apex:outputField value="{!Contract.StartDate}"/> 
                            <apex:outputField value="{!Contract.endContractDate__c}" />
                            <apex:outputField value="{!Contract.discount__c}"/>
                            <apex:outputField value="{!Contract.contract_sign_date__c}"/> 
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>  
                </apex:outputPanel>    
                    
                
                   <apex:pageBlockSection id="section4" columns="2" title="Informazioni sul sistema">
                        <apex:inlineEditSupport event="ondblClick">
                            <apex:inputField value="{!Contract.CreatedById}"/>
                            <apex:inputField value="{!Contract.LastModifiedById}"/>
                        </apex:inlineEditSupport>
                    </apex:pageBlockSection>  
                </apex:actionRegion>
                    
                </apex:pageBlock>
                </apex:inlineEditSupport>
             </apex:form>
  </apex:define>
</apex:page>
                   
Thank you in advance!!!
Chris  ByromChris Byrom
Youl could be getting an error back, but have no way to see it. Try adding a apex:pageMessages component to your page.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessages.htm
Lago S.p.a.Lago S.p.a.
Hi Chris, I tried to use showDetail="true" on apex:pageMessages component, but it gaves me an error:
Error: Unsupported attribute showdetail in <apex:pageMessage> in ContractDiscover at line 48 column 178
Chris  ByromChris Byrom
I would just start with this:
 
<apex:pageMessages />

 
Lago S.p.a.Lago S.p.a.
Yes, ok but in this Way it doesn't show nothing...
Chris  ByromChris Byrom
So it isn't generating any errors then when you are saving the record. Have you made changes on the page before clicking the save button? I have not used the inline edit support stuff before, so I don't know how that affects the save action.