![](/img/trans.png)
[英]Display <apex:inputField values> based on the value of the first input Field salesforce
[英]Error: Could not resolve field <apex:inputField>
嘗試編輯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>
問題與視野的可視性無關。 問題是在“參加者對象”上沒有名為Student_Id__c的字段,或者您拼錯了該字段的api名稱。 或者,Student_Id__c是其父級字段。 如果我不清楚,請告訴我。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.