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
Michael MMichael M 

Controlling field error

I am trying to create a VF page that has a sets of controlling picklists. CBO_Type controls CBO_Name. when I try to display the page, I get this error: "The inline edit-enabled dependent picklist 'CBO Name' requires its controlling field 'CBO Type' to be present on the page." 

Here is my page and controller extension....

Page:
<apex:page standardController="Discharge__c" extensions="DischargeCboRelatedExtension" lightningStylesheets="true">
<apex:form >
        <apex:pageBlock title="{!Discharge__c.Name}'s - CBOs" mode="inlineEdit" >
            <apex:pageBlockButtons location="top" >
                <apex:commandButton style="background:lightblue" value="New CBO" action="/003/e?retURL={!discharge__c.id}&accid={!discharge__c.id}" />
                <apex:commandButton style="background:lightblue" action="{!save}" value="Save" id="saveButton" />
                <apex:commandButton style="background:lightblue" onclick="resetInlineEdit()" id="cancelButton" value="Cancel" />
            </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!cbos}" var="item" style="background:skyblue">
                   <apex:column headerValue="Action" >
                            <apex:outputLink value="/{!item.id}/e?retURL=/apex/accountDisplay/{!Discharge__c.id}" target="_parent">Edit
                            </apex:outputLink>&nbsp;|&nbsp;
                           
                     <apex:outputLink value="{!URLFOR($Action.Contact.Delete, item.id)}&retURL=%2F{!Discharge__c.id}" target="_parent" onclick="return window.confirm('Are you sure?'); ">Delete
                      </apex:outputLink>       
                 </apex:column>  
                  
                                       
                <apex:column value="{! item.referral_date__c}" />
                <apex:column value="{!item.CBO_Type__c}" />
                <apex:column value="{! item.cbo_name__c}" />
                <apex:column value="{!item.Referral_Status__c}" /> 
                 <apex:column value="{!item.rejection_cancellation_reason__c}" />
                  <apex:column value="{!item.Start_of_Service__c}" />
                  <apex:column value="{!item.End_of_Service__c}" />
               
             <!--   <apex:column headerValue="Phones" >
                    <apex:outputField value="{!item.CBO_Type__c}">
                    <apex:inlineEditSupport showOnEdit="saveButton,cancelButton"
                        hideOnEdit="editButton" event="ondblclick"
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                </apex:outputField>

                </apex:column> -->
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class DischargeCboRelatedExtension {
    public List<Cbo__c> cbos {get;set;}

        public DischargeCboRelatedExtension(ApexPages.StandardController stdController) {
        this.cbos = [select id,cbo_type__c, cbo_name__c, cbo_address__c, phone_number__c,fax_number__c,referral_date__c,referral_status__c,rejection_cancellation_reason__c,start_of_service__c,end_of_service__c,secondary_organization__c from CBO__c where Discharge_Name__c =:stdController.getId()];

    }
        public PageReference save() {
        update cbos ;
        return null;
    }
}
Best Answer chosen by Michael M
VinayVinay (Salesforce Developers) 
Hi Micheal,

Please review below article and don’t mix inline edit-enabled fields with regular input fields from the same dependency group. For example, don’t mix a standard input field for a controlling field with an inline edit-enabled dependent field.

https://help.salesforce.com/articleView?id=000332625&type=1&mode=1

Update to below VF code:

<apex:page standardController="Discharge__c" extensions="DischargeCboRelatedExtension" lightningStylesheets="true">
<apex:form >
        <apex:pageBlock title="{!Discharge__c.Name}'s - CBOs" mode="inlineEdit" >
            <apex:pageBlockButtons location="top" >
                <apex:commandButton style="background:lightblue" value="New CBO" action="/003/e?retURL={!discharge__c.id}&accid={!discharge__c.id}" />
                <apex:commandButton style="background:lightblue" action="{!save}" value="Save" id="saveButton" />
                <apex:commandButton style="background:lightblue" onclick="resetInlineEdit()" id="cancelButton" value="Cancel" />
            </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!cbos}" var="item" style="background:skyblue">
                   <apex:column headerValue="Action" >
                            <apex:outputLink value="/{!item.id}/e?retURL=/apex/accountDisplay/{!Discharge__c.id}" target="_parent">Edit
                            </apex:outputLink>&nbsp;|&nbsp;
                           
                     <apex:outputLink value="{!URLFOR($Action.Contact.Delete, item.id)}&retURL=%2F{!Discharge__c.id}" target="_parent" onclick="return window.confirm('Are you sure?'); ">Delete
                      </apex:outputLink>       
                 </apex:column>              
                <apex:column value="{! item.referral_date__c}" />
                <apex:column value="{!item.CBO_Type__c}" />
                <apex:inlineEditSupport /></apex:column>
                <apex:column value="{! item.cbo_name__c}" />
                <apex:inlineEditSupport /></apex:column>
                <apex:column value="{!item.Referral_Status__c}" /> 
                 <apex:column value="{!item.rejection_cancellation_reason__c}" />
                  <apex:column value="{!item.Start_of_Service__c}" />
                  <apex:column value="{!item.End_of_Service__c}" />
               
             <!--   <apex:column headerValue="Phones" >
                    <apex:outputField value="{!item.CBO_Type__c}">
                    <apex:inlineEditSupport showOnEdit="saveButton,cancelButton"
                        hideOnEdit="editButton" event="ondblclick"
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                </apex:outputField>

                </apex:column> -->
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar

All Answers

VinayVinay (Salesforce Developers) 
Hi Micheal,

Please review below article and don’t mix inline edit-enabled fields with regular input fields from the same dependency group. For example, don’t mix a standard input field for a controlling field with an inline edit-enabled dependent field.

https://help.salesforce.com/articleView?id=000332625&type=1&mode=1

Update to below VF code:

<apex:page standardController="Discharge__c" extensions="DischargeCboRelatedExtension" lightningStylesheets="true">
<apex:form >
        <apex:pageBlock title="{!Discharge__c.Name}'s - CBOs" mode="inlineEdit" >
            <apex:pageBlockButtons location="top" >
                <apex:commandButton style="background:lightblue" value="New CBO" action="/003/e?retURL={!discharge__c.id}&accid={!discharge__c.id}" />
                <apex:commandButton style="background:lightblue" action="{!save}" value="Save" id="saveButton" />
                <apex:commandButton style="background:lightblue" onclick="resetInlineEdit()" id="cancelButton" value="Cancel" />
            </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!cbos}" var="item" style="background:skyblue">
                   <apex:column headerValue="Action" >
                            <apex:outputLink value="/{!item.id}/e?retURL=/apex/accountDisplay/{!Discharge__c.id}" target="_parent">Edit
                            </apex:outputLink>&nbsp;|&nbsp;
                           
                     <apex:outputLink value="{!URLFOR($Action.Contact.Delete, item.id)}&retURL=%2F{!Discharge__c.id}" target="_parent" onclick="return window.confirm('Are you sure?'); ">Delete
                      </apex:outputLink>       
                 </apex:column>              
                <apex:column value="{! item.referral_date__c}" />
                <apex:column value="{!item.CBO_Type__c}" />
                <apex:inlineEditSupport /></apex:column>
                <apex:column value="{! item.cbo_name__c}" />
                <apex:inlineEditSupport /></apex:column>
                <apex:column value="{!item.Referral_Status__c}" /> 
                 <apex:column value="{!item.rejection_cancellation_reason__c}" />
                  <apex:column value="{!item.Start_of_Service__c}" />
                  <apex:column value="{!item.End_of_Service__c}" />
               
             <!--   <apex:column headerValue="Phones" >
                    <apex:outputField value="{!item.CBO_Type__c}">
                    <apex:inlineEditSupport showOnEdit="saveButton,cancelButton"
                        hideOnEdit="editButton" event="ondblclick"
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                </apex:outputField>

                </apex:column> -->
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
This was selected as the best answer
Michael MMichael M
Hi Vinay,

When I try that, I can't save it because it has this problem: "You may specify either a ''value'' attribute or a body for the column component, but not both"
Michael MMichael M
HI Vinay-- it's working now, like this:

<apex:page standardController="Discharge__c" extensions="DischargeCboRelatedExtension" lightningStylesheets="true">
<apex:form >
        <apex:pageBlock title="{!Discharge__c.Name}'s - CBOs" mode="inlineEdit" >
            <apex:pageBlockButtons location="top" >
                <apex:commandButton style="background:lightblue" value="New CBO" action="/003/e?retURL={!discharge__c.id}&accid={!discharge__c.id}" />
                <apex:commandButton style="background:lightblue" action="{!save}" value="Save" id="saveButton" />
                <apex:commandButton style="background:lightblue" onclick="resetInlineEdit()" id="cancelButton" value="Cancel" />
            </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!cbos}" var="item" style="background:skyblue">
                   <apex:column headerValue="Action" >
                            <apex:outputLink value="/{!item.id}/e?retURL=/apex/accountDisplay/{!Discharge__c.id}" target="_parent">Edit
                            </apex:outputLink>&nbsp;|&nbsp;
                           
                     <apex:outputLink value="{!URLFOR($Action.Contact.Delete, item.id)}&retURL=%2F{!Discharge__c.id}" target="_parent" onclick="return window.confirm('Are you sure?'); ">Delete
                      </apex:outputLink>       
                 </apex:column>  
                  
                  <apex:column value="{! item.referral_date__c}" />
                  
                <apex:column headerValue="CBO Type"  >
                    <apex:outputField value="{!item.CBO_Type__c}">
                <apex:inlineEditSupport />
                    </apex:outputField>
                  </apex:column>
                  
                <apex:column headerValue="CBO Name" >
                    <apex:outputField value="{!item.CBO_name__c}">
                <apex:inlineEditSupport />
                    </apex:outputField>
                  </apex:column>
                  
                <apex:column headerValue="Referral Status" >
                    <apex:outputField value="{!item.Referral_Status__c}">
                <apex:inlineEditSupport />
                    </apex:outputField>
                  </apex:column>
                  
                  <apex:column headerValue="Rejection/Cancellation Reason" >
                    <apex:outputField value="{!item.rejection_cancellation_reason__c}">
                <apex:inlineEditSupport />
                    </apex:outputField>
                  </apex:column>


                  <apex:column value="{!item.Start_of_Service__c}" />
                  <apex:column value="{!item.End_of_Service__c}" />
               

            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Thank you!