You need to sign in to do that
Don't have an account?
himanshu huske 7
Constructor not defined: [System.SelectOption].<Constructor>(Id, String, String)
<apex:page controller="CustomerAmtTransfer">
<apex:form >
<apex:outputText>to</apex:outputText>>
<apex:selectList size="1" value="{!Name1}" >
<apex:selectOptions value="{!name1fields}"/>
</apex:selectList><br/>
<apex:outputText>from</apex:outputText>>
<apex:selectList size="1" value="{!Name2}" >
<apex:selectOptions value="{!name2fields}"/>
</apex:selectList>
</apex:form>
</apex:page>
public class CustomerAmtTransfer {
public String Name1 { get; set; }
public String Name2 { get; set; }
public String getName1fields() {
List<Selectoption> listName1 = new List<selectoption>();
listName1.add(new selectOption('', '- None -'));
for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
listName1.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
}
return listName1;
}
public String getName2fields() {
List<Selectoption> listName2 = new List<selectoption>();
listName1.add(new selectOption('', '- None -'));
for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
listName2.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
}
return listName2;
}
}
<apex:form >
<apex:outputText>to</apex:outputText>>
<apex:selectList size="1" value="{!Name1}" >
<apex:selectOptions value="{!name1fields}"/>
</apex:selectList><br/>
<apex:outputText>from</apex:outputText>>
<apex:selectList size="1" value="{!Name2}" >
<apex:selectOptions value="{!name2fields}"/>
</apex:selectList>
</apex:form>
</apex:page>
public class CustomerAmtTransfer {
public String Name1 { get; set; }
public String Name2 { get; set; }
public String getName1fields() {
List<Selectoption> listName1 = new List<selectoption>();
listName1.add(new selectOption('', '- None -'));
for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
listName1.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
}
return listName1;
}
public String getName2fields() {
List<Selectoption> listName2 = new List<selectoption>();
listName1.add(new selectOption('', '- None -'));
for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
listName2.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
}
return listName2;
}
}
Greetings to you!
The SelectOption constructors signature is public SelectOption(String value, String label)
You are using 3 parameters instead of two. Please try below code, I have changed a few things in your code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas