I have a custom object, Foobar__c
, and I would like to create a VisualForce page containing a form in which the user has to select a Foobar__c
via the standard Lookup popup for Foobar__c
. I would ideally like the input for this field to be styled with the magnifying glass icon to the right of it, just like the user would see if they were editing an object that has a Foobar__c
field.
I know that if I make an inputField
whose value
is a property of type Foobar__c
of some other custom object, then Salesforce will automatically figure out that it needs to create a Foobar__c
lookup input.
However, in my case the field being set by the input is not a property of some other custom object; it is simply a property of the page's Apex controller, which will be used when the form is saved. Trying to set the value
input of the inputField
to this property simply gives me the error message:
Could not resolve the entity from apex:inputField value binding '{!foobar}'. apex:inputField can only be used with SObjects, or objects that are Visualforce field component resolvable.
How can I create a custom object Lookup input for straightforward controller property, rather than for a property of a Salesforce object?