尝试编辑Visualforce页面中显示的字段,并且不熟悉编码。我收到此(示例)错误消息:
Error: Could not resolve field 'Student_Id__c' from <apex:inputField> value binding '{!att.Student_Id__c}' in page AddAttendee
非常感谢任何帮助!
原创,工作页面:
<apex:page controller="AddAttendee" id="page" showHeader="false">
<c:CCHeader />
<script type="text/javascript">
var count = 0;
function funcA() {
//debugger;
if({!!setCount}){return;}
else{
for(var a=0;a<=count;a++){
var divObj = document.getElementById('page:formId:pageBlockId:pageBlockTableclsAttendees:'+a+':attCont');
var child = divObj.children[0];
child.style.textDecoration = 'none';
child.style.color = 'black';
child.removeAttribute('href');
child.removeAttribute('onblur');
child.removeAttribute('onfocus');
child.removeAttribute('onmouseout');
child.removeAttribute('onmouseover');
}
count++;
}
}
</script>
<apex:form id="formId">
<apex:outputPanel id="errorPanelId">
<apex:pageMessages />
</apex:outputPanel>
<apex:pageBlock id="pageBlockId">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!doSave}" rerender="errorPanelId" />
<apex:commandButton value="Cancel" action="{!cancelSave}" rerender="errorPanelId" />
</apex:pageBlockButtons>
<apex:pageBlockSection id="SectionId1" columns="4">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Select Contact: " />
<apex:inputField value="{!att.Contact__c}" required="false"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="Add" action="{!AddContact}" oncomplete="funcA();" rerender="pageBlockId,SectionId1,PanelId,pageBlockTableclsAttendees"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="PanelId" >
<apex:pageBlockTable id="pageBlockTableclsAttendees" value="{!tempList}" var="att" rendered="{!tempList.size > 0}">
<apex:column headerValue="Attendee Name">
<apex:outputField StyleClass="AttendeeName" id="attCont" value="{!att.Contact__c}" />
</apex:column>
<apex:column headerValue="Student ID Number">
<apex:inputField id="attStudentId" value="{!att.Student_Id__c}" />
</apex:column>
<apex:column headerValue="Gender">
<apex:inputField id="attGender" value="{!att.Gender__c}" />
</apex:column>
<apex:column headerValue="Amount Paid">
<apex:inputField id="attAmount" value="{!att.Amount_Paid__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
编辑我希望:
<apex:page controller="AddAttendee" id="page" showHeader="false">
<c:CCHeader />
<script type="text/javascript">
var count = 0;
function funcA() {
//debugger;
if({!!setCount}){return;}
else{
for(var a=0;a<=count;a++){
var divObj = document.getElementById('page:formId:pageBlockId:pageBlockTableclsAttendees:'+a+':attCont');
var child = divObj.children[0];
child.style.textDecoration = 'none';
child.style.color = 'black';
child.removeAttribute('href');
child.removeAttribute('onblur');
child.removeAttribute('onfocus');
child.removeAttribute('onmouseout');
child.removeAttribute('onmouseover');
}
count++;
}
}
</script>
<apex:form id="formId">
<apex:outputPanel id="errorPanelId">
<apex:pageMessages />
</apex:outputPanel>
<apex:pageBlock id="pageBlockId">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!doSave}" rerender="errorPanelId" />
<apex:commandButton value="Cancel" action="{!cancelSave}" rerender="errorPanelId" />
</apex:pageBlockButtons>
<apex:pageBlockSection id="SectionId1" columns="5">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Select Contact: " />
<apex:inputField value="{!att.Contact__c}" required="false"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="Add" action="{!AddContact}" oncomplete="funcA();" rerender="pageBlockId,SectionId1,PanelId,pageBlockTableclsAttendees"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="PanelId" >
<apex:pageBlockTable id="pageBlockTableclsAttendees" value="{!tempList}" var="att" rendered="{!tempList.size > 0}">
<apex:column headerValue="Attendee Name">
<apex:outputField StyleClass="AttendeeName" id="attCont" value="{!att.Contact__c}" />
</apex:column>
<apex:column headerValue="Student ID Number">
<apex:inputField id="attStudentId" value="{!att.Student_Id__c}" />
</apex:column>
<apex:column headerValue="Gender">
<apex:inputField id="attGender" value="{!att.Gender__c}" />
</apex:column>
<apex:column headerValue="Ethnicity">
<apex:inputField id="attEthnicity" value="{!att.Ethnicity__c}" />
</apex:column>
<apex:column headerValue="Grade">
<apex:inputField id="attGrade" value="{!att.Grade__c}" />
</apex:column>
<apex:column headerValue="School">
<apex:inputField id="attSchool" value="{!att.School__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
答案 0 :(得分:0)
问题与字段的可见性无关。问题是Attendee对象上没有名为Student_Id__c的字段,或者您拼错了该字段的api名称。 或者可能是Student_Id__c是其Parent的字段。如果我不清楚,请告诉我。