You need to sign in to do that
Don't have an account?
Vidhyasagaran Muralidharan
Binding problem
Apex code:
Public class drop
{
public List<SelectOption> addopt{get;set;}
Public string name{get;set;}
Public void drop()
{
addopt= new List<SelectOption>();
}
Public void addlist()
{
addopt.add(new SelectOption(name,name));
}
}
Vf page:
<apex:page controller="drop">
<apex:form >
<apex:inputField value="{!name}"/>
<apex:selectList id="lis">
<apex:selectOptions value="{!addOpt}">
</apex:selectOptions>
</apex:selectList><p/>
<apex:commandButton action="{!addlist}" value="Save" reRender="lis"/>
</apex:form>
</apex:page>
Error:Error: Could not resolve the entity from <apex:inputField> value binding '{!name}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable
Guys help me out
Public class drop
{
public List<SelectOption> addopt{get;set;}
Public string name{get;set;}
Public void drop()
{
addopt= new List<SelectOption>();
}
Public void addlist()
{
addopt.add(new SelectOption(name,name));
}
}
Vf page:
<apex:page controller="drop">
<apex:form >
<apex:inputField value="{!name}"/>
<apex:selectList id="lis">
<apex:selectOptions value="{!addOpt}">
</apex:selectOptions>
</apex:selectList><p/>
<apex:commandButton action="{!addlist}" value="Save" reRender="lis"/>
</apex:form>
</apex:page>
Error:Error: Could not resolve the entity from <apex:inputField> value binding '{!name}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable
Guys help me out
Anoop, is right use <apex:inputText> insted of <apex:inputField>.
And please remove ' Void ' return from constractor . It will work fine.
Apex Controller-
Vf Page-
Viru
All Answers
Use <apex:inputText value="{!name}"/> as it is a variable.
but if i enter a text in visualforce text box it is not adding in the picklist
Error isSystem.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!addlist}' in component <apex:commandButton> in page dropdown
Anoop, is right use <apex:inputText> insted of <apex:inputField>.
And please remove ' Void ' return from constractor . It will work fine.
Apex Controller-
Vf Page-
Viru