You need to sign in to do that
Don't have an account?
Pat Wimsatt
apex:inputField
Any idea why this is throwing an error: Error: Could not resolve the entity from <apex:inputField> value binding '{!lanes.origin_city__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
my vfp file...
<apex:form >
<apex:pageBlock title="OD List" id="od_list" mode="edit">
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!lanes.origin_city__c}"/>
<apex:inputField value="{!lanes.origin_statess__c }"/>
<apex:inputField value="{!lanes.Destination_City__c }"/>
<apex:inputField value="{!lanes.Destination_States__c}"/>
</apex:pageBlockSection>
Here's my controller:
public class LaneDetailCon {
static List<Lane_Detail__c> lanes;
public static List<Lane_Detail__c> getLanes() {
String City = ApexPages.currentPage().getParameters().get('origin_city__c');
lanes = [SELECT Origin_City__c, Origin_Statess__c, Destination_City__c,
Destination_States__c, Rate__c FROM Lane_Detail__c
WHERE Origin_City__c = :City
LIMIT 25];
return lanes;
}
}
my vfp file...
<apex:form >
<apex:pageBlock title="OD List" id="od_list" mode="edit">
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!lanes.origin_city__c}"/>
<apex:inputField value="{!lanes.origin_statess__c }"/>
<apex:inputField value="{!lanes.Destination_City__c }"/>
<apex:inputField value="{!lanes.Destination_States__c}"/>
</apex:pageBlockSection>
Here's my controller:
public class LaneDetailCon {
static List<Lane_Detail__c> lanes;
public static List<Lane_Detail__c> getLanes() {
String City = ApexPages.currentPage().getParameters().get('origin_city__c');
lanes = [SELECT Origin_City__c, Origin_Statess__c, Destination_City__c,
Destination_States__c, Rate__c FROM Lane_Detail__c
WHERE Origin_City__c = :City
LIMIT 25];
return lanes;
}
}
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!lanes[0].origin_city__c}"/>
<apex:inputField value="{!lanes[0].origin_statess__c }"/>
<apex:inputField value="{!lanes[0].Destination_City__c }"/>
<apex:inputField value="{!lanes[0[.Destination_States__c}"/>
</apex:pageBlockSection>
Refer the URL to see how <apex:repeat> can be used -> https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm
All Answers
Greetings!
I would request you to double check the API name of the field to refer on the <apex:inputField> tag since it should be from the SObject referred.
Reference:https://salesforce.stackexchange.com/questions/34401/apexinputfield-can-only-be-used-with-sobjects
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!lanes[0].origin_city__c}"/>
<apex:inputField value="{!lanes[0].origin_statess__c }"/>
<apex:inputField value="{!lanes[0].Destination_City__c }"/>
<apex:inputField value="{!lanes[0[.Destination_States__c}"/>
</apex:pageBlockSection>
Refer the URL to see how <apex:repeat> can be used -> https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm
<apex:repeat value="{!lanes}" var="lane">
<apex:outputtext value="{!lane.origin_city__c}"/>
<apex:outputtext value="{!lane.origin_statess__c }"/>
<apex:outputtext value="{!lane.Destination_City__c }"/>
<apex:outputtext value="{!lane.Destination_States__c}"/>
</apex:repeat>
Please mark this as the best answer if it serves the purpose. This will be helpful for others in future.