Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

I think there are two issues:

  • apex:inputField can only bind to an SObject field (as it takes the type and label from the field metadata) but you are trying to bind it to a String; use apex:inputText instead
  • you have not provided get/set methods for OrderItem.test; one way to accomplish this is to change the code to initialise in the constructor and then use a public String test {get; set;} Apex Property
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.