Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to develop a color picker using JSColor but I don't know how to do it with an <apex:inputField>. I have the error below :

Save error: Could not resolve the entity from value binding '{!color}'. can only be used with SObjects, or objects that are Visualforce field component resolvable.

Here's my code :

VF :

<apex:inputField styleClass="color" value="{!color}" />

Controller :

public SObject color {get; set;}

I can't use another object type like String. But it doesn't work with SObject.

Do I need to use a standard object like Account or a custom object saved in database ? I don't want to create a custom object only for store the color. If possible I just want to store it in a controller field.

share|improve this question
Try to use apex:inputText instead. – Sergey Utko Aug 26 '14 at 12:18
So obvious, I didn't think about that. Thanks mast0r, it works but now I have a problem with the JSColor library. I can't see the color I'm choosing... – SF_user Aug 26 '14 at 12:28
up vote 2 down vote accepted

SObject is a complex type. Therefore you cannot assign a simple value like a color code (string).

In your case it makes sense to add a custom field to your sObject (e.g. Color__c). This field can be referenced by anAccount.Color__c.


public Account anAccount {get; set;}


<apex:inputField styleClass="color" value="{!anAccount.Color__c}" />
share|improve this answer

Your Answer


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.