1

So I have the following componenet,

<apex:component>
<apex:attribute name="label" description="This is pretty name for this input" type="String" required="true"/>
<apex:attribute name="id" description="A one word description of this label" type="String" required="true"/>
<apex:attribute name="input" description="A one word description of this label" type="String" required="true"/>
<div class="form-group col-md-12">
  <label for="input{!label}" class="col-md-2 control-label">{!label}</label>
  <div class="col-md-6 form-control-wrapper">
    <apex:inputField styleClass="form-control empty" id="inputDescription" html-rows="4" value="{!input}" />
    <span class="material-input"></span>
  </div>
</div>
</apex:component>

The problem is that I can not save this component. I get this error,

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

I want this to be dynamic so that I can pass whatever value I want for the inputField and it will write the same markup every time. Does anyone know how to do this?

2
  • 1
    When I posted this code into the DC, I got the error you did but on {!input}. The reason for this is that apex:inputField attribute value= has to resolve to an SObject.field, not a string
    – cropredy
    Jan 30, 2015 at 23:04
  • That did it!! I wasn't reading the error correctly!! If you submit as an answer I'll accept it.
    – Grady D
    Jan 31, 2015 at 0:32

2 Answers 2

1

When I posted this code into the DC, I got the error you did but on {!input}. The reason for this is that apex:inputField attribute value= has to resolve to an SObject.field, not a string

0

I was able to save the component after changing inputField to inputText.

enter image description here

1
  • Sadly, this will not work because I can not easily associate the inputText with the field on the object. It also does not automatically build out dropdown selects and text areas. How can I get the sobject so I can use inputField?
    – Grady D
    Jan 30, 2015 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .