can only be used with SObjects, or objects that are Visualforce field component resolvable

451    Asked by AngelaBaker in Salesforce , Asked on Jul 19, 2021

I have a VF page that has pageblock table on it which displays data from a list. I am trying to add a field from that list in the pageblock table as a input field but I get the below error for the quantity field. How can I use a field from a list of non sObject as input field ?

can only be used with SObjects, or objects that are Visualforce field component resolvable.

Code : Controller

public class TestController_NWL{ public class OrderProduct{ public String materialNumber {get; set;} public Integer quantity {get; set;} } Public List orderProductsList {get; set;} }

VF Page :

 {!HTMLENCODE(op.materialNumber)} 

 How to resolve error? How do I use Apex inputField correctly?


Answered by Ankesh Kumar

If it's not an sObject field, you have to use one of the typed input tags. In your case, you would use .

Additional options include to handle other data types.

When used in an , tags automatically display with their corresponding output label. Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only and apex:outfield can be used with sObject fields.



Your Answer

Interviews

Parent Categories