2012-05-10 109 views
0

私は、カスタムオブジェクト「Assure__c」とカスタム頂点クラス、このような「insEnfant」作成しました:エラー:不明なコンストラクタ

<apex:page standardController="Assure__c" extensions="insEnfant" standardStylesheets="true"> 
    <apex:sectionHeader title="Ajouter un assuré" 
     subtitle="{!$User.FirstName}" help="/help/doc/user_ed.jsp?loc=help"></apex:sectionHeader> 
    <apex:form > 
     <apex:pageBlock title="Nouveau assuré" id="thePageBlock" mode="edit"> 
      <apex:pageBlockButtons > 
       <apex:commandButton action="{!save}" value="Enregistrer"></apex:commandButton> 
       <apex:commandButton action="{!cancel}" value=" Annuler "></apex:commandButton> 
      </apex:pageBlockButtons> 

      <apex:pageBlockSection title="Liste des enfants" columns="1" 
       rendered="{!IF(Assure__c.Nombre_enfants__c > 0, true, false)}"> 


      <apex:pageBlockTable value="{!accts}" var="a" id="table"> 
       <apex:facet name="footer"> 
        <apex:commandLink value="Ajouter" action="{!addRow}" rerender="table,error"/> 
       </apex:facet> 

       <apex:column headerValue="Nom"> 
        <apex:inputHidden value="{!Assure__c.Name}" id="theHiddenInput"/> 
       </apex:column> 
       <apex:column headerValue="Nom"> 
        <apex:inputField value="{!a.Name}"/> 
       </apex:column> 
       <apex:column headerValue="Prénom"> 
        <apex:inputField value="{!a.Prenom__c}"/> 
       </apex:column> 
           <apex:column headerValue="Né le"> 
        <apex:inputField value="{!a.Date_de_naissance__c}"/> 
       </apex:column> 
           <apex:column headerValue="Lieu de naissance"> 
        <apex:inputField value="{!a.Lieu_de_naissance__c}"/> 
       </apex:column> 
           <apex:column headerValue="Situation"> 
        <apex:inputField value="{!a.Situation__c }"/> 
       </apex:column>       
      </apex:pageBlockTable> 

      </apex:pageBlockSection> 

      </apex:pageblock> 
    </apex:form> 
</apex:page> 


public class insEnfant{ 

    public List<Enfants__c> accts {get; set;} 

    public insEnfant(){ 
     accts = new List<Enfants__c>(); 
     accts.add(new Enfants__c()); 
    } 

    public void addrow(){ 
     accts.add(new Enfants__c()); 
    } 

    public PageReference save(){ 
     insert accts; 
     PageReference home = new PageReference('/home/home.jsp'); 
     home.setRedirect(true); 
     return home; 
    } 
} 

をしかし、私はそれを保存しようとしたとき、私はこのエラーを取得:

Error: Unknown constructor 'insEnfant.insEnfant(ApexPages.StandardController controller)' 
Create Apex method 'insEnfant.insEnfant(ApexPages.StandardController controller)' 

私はsalesforce.comを初めて利用しているので、誰でもこのコードを教えていただけますか?

答えて

2

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htmを見てください。コントローラの拡張機能には、引数としてStandardControllerを持つコンストラクタが必要であることが説明されています。 (引数を取らないコンストラクタを用意しました。)そのページに役立つサンプルコードがあります。

+0

私は問題を解決しました。ありがとう – Netmaster

関連する問題