Why I will get all the time this error?
Could not resolve the entity from value binding
'{!order.test}'. <apex:inputField> can only be used with SObjects, or
objects that are Visualforce field component resolvable.
OrderItem – Class:
public with sharing class OrderItem {
public OrderItem(){
this(null);
}
public OrderItem(String contactId){
this.contactId = contactID;
}
public String test = 'test';
}
Contact – Extension Class
public with sharing class ExtendedContact {
public Contact contact {get; set;}
public OrderItem order {
get {
if (order == null)
order = new OrderItem();
return order;
}
set;
}
}
Page:
<apex:page standardController="Contact" extensions="ExtendedContact">
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"/>
<apex:pageblock title="ExtendedContact">
<apex:pageBlockSection title="Title" columns="1">
<apex:inputField value="{!order.test}"
label="greetText"
style="width:300px; height:100px" required="TRUE"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Thanks for any help.
Best Answer
I think there are two issues:
OrderItem.test
; one way to accomplish this is to change the code to initialise in the constructor and then use apublic String test {get; set;}
Apex Property