• bittu
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

How to over come this error:

 

Save error: Constructor not defined: [wrappercls.InnerClassWrapper].<Constructor>(Boolean, SOBJECT:Contact)at line 10 column 22

 

public with sharing class wrappercls {
    
    public InnerClassWrapper objICW {get;set;}
    public list<InnerClassWrapper> lstw {get; set;}
    public wrappercls()
    {
        lstw = new list<InnerClassWrapper>();
        list<Contact> lstcon = [select id,name,phone from Contact];
        for(Contact co : lstcon){
            objICW = new InnerClassWrapper(false, co);
            lstw.add(objICW);
        }
       list<Account> lstacc = [select id,name,phone from Account];
        for(Account ac : lstacc){
            objICW = new InnerClassWrapper(false,ac);
            lstw.add(objICW);
        }
    }
    public class InnerClassWrapper
    {
    public boolean isChecked {get; set;}
    public Contact con {get; set;}
    public Account acc {get; set;}
        
        public InnerClassWrapper(boolean a,Contact b,Account c){
            ischecked = a;
            acc = c;
            con = b;
        }
    }
}

 

 

 

  • October 23, 2013
  • Like
  • 0

I'm trying to get phone value from VF page contact picklist if contact name is selected then phone field of that record need to be display in <apex:inputText title="Phone" />vf page how to do that 

page code:

<apex:page controller="PickList_cls11">
  <apex:form >
      <apex:actionFunction name="change" action="{!dochange}"/>
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:selectList label="Account Names" size="1" onchange="change()" value="{!Aname}" >
                  <apex:selectOptions value="{!options}" >
                  </apex:selectOptions>
              </apex:selectList>
              <apex:selectList label="Contact Names" size="1" value="{!Cname}">
                  <apex:selectOptions value="{!conNames}" >&nbsp;
                  <apex:commandButton value="Show Contact" action="{!Showcon}"/>
                  </apex:selectOptions>
              </apex:selectList>
              <apex:outputText label="Phone">
                  <apex:inputText title="Phone" value="{!cphone}"/>
              </apex:outputText>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

 class;

 

public with sharing class PickList_cls {

    public Contact objb {get; set;}
    public string Cname {get; set;}
    public string Aname {get; set;} 
    public list<SelectOption> options{get; set;}
    public list<selectoption> conNames {get; set;}
    public PickList_cls (){
    objb = new contact();
    options = new List<Selectoption>();
    options.add(new selectoption('--None--','--None--'));
    //for(Account a: [Select id, name, (select id,name from Contacts) from Account order by name]){
    for(Account a: [Select id, name from Account order by name]){
      options.add(new selectOption(a.Id,a.name));
      }
      conNames = new list<selectoption>();
  } 
  public void dochange(){
      conNames.clear();
      conNames.add(new selectoption('Select','Select'));
      for(Contact c:[select id,name from Contact where AccountId=:Aname order by name ])
          conNames.add(new selectoption(c.id,c.name));
      }
    public pagereference Showcon(){
        
        return null;    
    }
    
}

 

  • October 22, 2013
  • Like
  • 0

How to over come this error:

 

Save error: Constructor not defined: [wrappercls.InnerClassWrapper].<Constructor>(Boolean, SOBJECT:Contact)at line 10 column 22

 

public with sharing class wrappercls {
    
    public InnerClassWrapper objICW {get;set;}
    public list<InnerClassWrapper> lstw {get; set;}
    public wrappercls()
    {
        lstw = new list<InnerClassWrapper>();
        list<Contact> lstcon = [select id,name,phone from Contact];
        for(Contact co : lstcon){
            objICW = new InnerClassWrapper(false, co);
            lstw.add(objICW);
        }
       list<Account> lstacc = [select id,name,phone from Account];
        for(Account ac : lstacc){
            objICW = new InnerClassWrapper(false,ac);
            lstw.add(objICW);
        }
    }
    public class InnerClassWrapper
    {
    public boolean isChecked {get; set;}
    public Contact con {get; set;}
    public Account acc {get; set;}
        
        public InnerClassWrapper(boolean a,Contact b,Account c){
            ischecked = a;
            acc = c;
            con = b;
        }
    }
}

 

 

 

  • October 23, 2013
  • Like
  • 0