You need to sign in to do that
Don't have an account?
Apex:Inputfield with custom controller
HI,
I am trying to get two values from the user input . I am getting error as
<apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
Controller
---------------
public class AdditionController
{
public integer A;
public integer B;
public AdditionController addctl{get;set;}
public integer getA()
{
return this.A;
}
public void setA(integer val)
{
this.A=val;
}
public integer getB()
{
return this.B;
}
public void setB(integer val)
{
this.B=val;
}
}
VF Page
---------------
<apex:page controller="AdditionController">
<apex:form >
<apex:inputField id="A" value="{!addctl.A}"/>
<apex:inputField id="B" value="{!addctl.B}"/>
</apex:form>
</apex:page>
Thanks.
<apex:inputField> can only be used with SObjects.
for example you can use like this <apex:inputField value="{!Account.Name}">
But for you requirement use <apex:inputText>
Inputfield should be binded to a field of object only.
for example
account a = new account ();
<apex:inputfield value="{!a.name}"/>
Hit kudos and mark as answer if it helps you.
Thanks
Additional options include <apex:inputcheckbox and <apex:inputTextArea> to handle other data types.