You need to sign in to do that
Don't have an account?

Could not resolve the entity from <apex:inputField> value error on VF Page
Hi all,
I had this page absoultely working before. I didnt make any changes to the code and it has stopped working.
I have a custom object that has this field - ScoringRule_Rule1__c (picklist).
On visualforce page, it keeps complaining that it cant bind an inputField to something that is not an object's field.
Here is my Controller code:
public class newScoreRuleController {
// Declarations
public List<ScoringRule__c> ScoringRule { get; private set;}
// Constructor Method
public newScoreRuleController () {
// Give me blank lines of my Object
ScoringRule = new List<ScoringRule__c>();
for (integer i = 0; i < 5; i++) {
ScoringRule.add( new ScoringRule__c() );
}
}
}
Here is my Visualforce Code:
<apex:page controller="newScoreRuleController" tabStyle="Lead">
<apex:sectionHeader title="Scoring Rule Wizard" subtitle="Step 2 of 2"/>
<apex:form >
<apex:pageBlock title="Choose a scoring rule" mode="edit">
<apex:messages styleClass="error" />
<apex:pageBlockSection title="Choose a scoring rule">
<apex:pageBlockTable value="{!ScoringRule}" var="sr" id="theTable" rowClasses="odd,even"
styleClass="tableClass" rows="5">
<apex:column >
<apex:facet name="header">Field</apex:facet>
<apex:facet name="footer"></apex:facet>
<apex:outputText value="{!fieldName}"/>
</apex:column>
<apex:column width="25%">
<apex:facet name="header">Operator 1</apex:facet>
<apex:outputPanel layout="block" styleClass="requiredInput">
<apex:outputPanel layout="block" styleClass="requiredBlock"/>
<apex:inputField value="{!sr.ScoringRule_Rule1__c}" required="true"/>
</apex:outputPanel>
</apex:column>
</apex:pageBlockTable>
<!-- Within a pageBlockSection, inputFields always display with their
corresponding output label. -->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Any help is much appreciated!
Regards
Mukul
Thanks for replying Ron. I had that method before in my controller. I by mistake didn't add it in the forum.
I was able to fix the issue by deleting all Apex classes and Visualforce pages and copying the same code in newly created classes and VF Pages.
I dont know how that worked though. Do you know why? Was it just some version number conflict? What if it happens again?
Regards
Mukul
All Answers
Yes. I have done that. I hit the spacebar and tried saving it again.
What can be the problem again? Can you please explain one more time?
Thanks again!
Regards
Mukul
This almost always happens when the API name in the value attribute
does not match the actual API name.
At any point have you changed the type or name of this field? If the value is indeed correct I would consider opening a case as I have not seen anything else cause this issue before.
I din't change the type of this field in particular. I changed the name of this field. But it was working even after i changed the name of the field. The last thing i did before it stopped working was adding more fields in the Object. I tried removing those too. That din't help either.
Thanks again, Jason!
Regards
Mukul
try changing the version on the visualforce file, everything else looks ok to me.
otherwise you can file a case with support.
I tried changing the version. That dint help. I will open a case with the Support. Do you know how much time will it take for the Support to get back to me?
Regards
Mukul
your Page and Controller would not save for me because it is missing getFieldName()
can you try to correct that first, perhaps it will then save
here is my version of your code, it does save correctly.
public class newScoreRuleController { public String getFieldName() { return 'Name'; } // Declarations public List<Opportunity> ScoringRule { get; private set;} // Constructor Method public newScoreRuleController () { // Give me blank lines of my Object ScoringRule = new List<Opportunity>(); for (integer i = 0; i < 5; i++) { ScoringRule.add( new Opportunity() ); } } }
<apex:page controller="newScoreRuleController" tabStyle="Lead"> <apex:sectionHeader title="Scoring Rule Wizard" subtitle="Step 2 of 2"/> <apex:form > <apex:pageBlock title="Choose a scoring rule" mode="edit"> <apex:messages styleClass="error" /> <apex:pageBlockSection title="Choose a scoring rule"> <apex:pageBlockTable value="{!ScoringRule}" var="sr" id="theTable" rowClasses="odd,even" styleClass="tableClass" rows="5"> <apex:column > <apex:facet name="header">Field</apex:facet> <apex:facet name="footer"></apex:facet> <apex:outputText value="{!fieldName}"/> </apex:column> <apex:column width="25%"> <apex:facet name="header">Operator 1</apex:facet> <apex:outputPanel layout="block" styleClass="requiredInput"> <apex:outputPanel layout="block" styleClass="requiredBlock"/> <apex:inputField value="{!sr.name}" required="true"/> </apex:outputPanel> </apex:column> </apex:pageBlockTable> <!-- Within a pageBlockSection, inputFields always display with their corresponding output label. --> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
the problem is probably the missing getter for field Name or typo in your input field name, not a bug as i previously mentioned.
Thanks for replying Ron. I had that method before in my controller. I by mistake didn't add it in the forum.
I was able to fix the issue by deleting all Apex classes and Visualforce pages and copying the same code in newly created classes and VF Pages.
I dont know how that worked though. Do you know why? Was it just some version number conflict? What if it happens again?
Regards
Mukul
Hi,
I realise this is an old thread but i had this problem pop up today, and it had me confused for a few minutes.
I was iterating over a list of Product2 objects in a pageBlockTable in my page, it had been working previously and i hadn't touched that part of the code so i was a little lost...
I tried using inputText instead of inputField and the page loaded as expected, which only added to my confusion really.
I found the problem was i had used the 'var' name twice in different blocks on the page
apex:pageblockTable value="{!oProds}" var="s"
i changed it to
apex:pageblockTable value="{!oProds}" var="y"
for one of the tables and lo' it was all good again.