function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MukulMukul 

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

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MukulMukul

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

TehNrdTehNrd
Have you made a minor change (hit the space bar) on the page and the controller and then tried to resave? If there is some sort of schema conflict it should let you know when you try to save.
Message Edited by TehNrd on 07-09-2009 01:00 PM
MukulMukul

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

TehNrdTehNrd

This almost always happens when the API name in the value attribute

 

{!sr.ScoringRule_Rule1__c}

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.

 

Message Edited by TehNrd on 07-09-2009 01:06 PM
Message Edited by TehNrd on 07-09-2009 01:07 PM
MukulMukul

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

Ron HessRon Hess

try changing the version on the visualforce file, everything else looks ok to me.

 

otherwise you can file a case with support.

MukulMukul

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

Ron HessRon Hess

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

Ron HessRon Hess

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.

 

 

 

MukulMukul

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

This was selected as the best answer
dannodanno

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.