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
tonante27tonante27 

"The dependent picklist requires its controlling field to be present on the page " with both fields included within a Visual Force component

Help:  

I am getting this  error but not sure why because of these steps:
1) Create a component in order to add a plugin for Address Verification called Smarty Streets
2) The component includes both Address fields for Billing/SHipping as well as Crtedit Card Payment fields
3) Among those fields listed within the component, I have included both the controlling picklist (Payment Method)  and its dependent picklist (Card Type)
4) Add the component to the main page.
5) Make sure that e both fields mentioned in step 3  have Read/Write access and are visiable.
6) Bring up the Apex Page
7) Verify that this error occurs.

Why am I getting this error if I am including both those fields?  

 Thanks
Best Answer chosen by tonante27
tonante27tonante27
Ok I solved the issue.
I had to remove the DIV tags for the Credit card / Payment Billing info  from th VF Component and place it in the main VF page. Thus the component only has to contain the Address Verification segment. This block of DIVs include both the controlling field  (Payment Type) and the dependent picklist (Credit Type). So when the main VF Page is loaded  it sees the two fields loaded on this page and so no longer throws and error while waiting for the component to load.

All Answers

tonante27tonante27
Let me explain with code:  As you will see
  • I am wrapping the component fields inside HTML, Header, and Script tags in order for Smarty Streets to activate the autocomplete lookup 
  • I have added the <apex form>  using DIV Tag elkements for the input fields. Card Type and  its controlling field - Payment Method - are both included in this form. (I have underliined the input field fpr Payment Method and Card Type below.
Why is the page not recognizing that the controlling field Payment Method is not included on the page for the dependent Card Type ?
<apex:component >
 <!-- #1 for help on Standard Controllers in components See https://developer.salesforce.com/forums/?id=906F00000008zHCIAY --> 
 <!-- #2 Implement step 1 above with: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust_elements_attributes.htm -->
 <!-- take out all of the SelectAddressDialog from OE4_VF Page and substitute this instead. -->
   <html>
        
    <head>
 <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" />
 <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js" />
 <apex:includeScript value="/soap/ajax/21.0/connection.js" />
 <apex:includeScript value="/soap/ajax/21.0/apex.js" /> 
 <apex:includeScript value="https://d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js"/> 
 <apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/ui-lightness/jquery-ui.css" />
 <apex:attribute name="Order" description="This is the value for the component." type="Order" />   	 
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" />
        <script src="https://d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/5.1/jquery.liveaddress.min.js" />
 <script type="text/javascript">
        // get the session id
        var __sfdcSessionId = '{!GETSESSIONID()}';

        // get image urls for preloading
        var __loading_url = '{!URLFOR($Resource.Loading_SpinningArrows)}';
        var __plus_url = '{!URLFOR($Resource.Small_Circle_Plus)}';
        var __checkmark_url = '{!URLFOR($Resource.Small_Circle_Checkmark)}';
        var __information_url = '{!URLFOR($Resource.Small_Circle_Information)}';
        var __exclamation_url = '{!URLFOR($Resource.Small_Circle_Exclamation)}';
        var __delete_url = '{!URLFOR($Resource.Small_Circle_Delete)}';
        var __puzzle_url = '{!URLFOR($Resource.Small_Puzzle_Piece)}';
         
     var ss=jQuery.LiveAddress({
            	key: SomeKey,
               waitForStreet: true,
                   //verifySecodary: true,
                debug: true,
                target: "US",
                    autocomplete: 7,    
                   	autoVerify :false,
                    //enforceVerification:true,
                    // submitVerify: true,
                addresses: [{
                    address1: "#AddAddressLineOne",
                    address2: "#AddAddressLineTwo",
                    locality: "#AddAddressCity",
                    administrative_area: "#AddAddressState",
                    //country: "#AddAddressCountry",
                    postal_code: "#AddAddressZipCode"
                }]
            });
    		</script>
        </head>   
     <body>
      
       <!-- <apex:form>  --> 
       <div id="SelectAddressDialog">    <!-- Removing this will give us SmartyStreets Verify -->
             <apex:form >
              
              <div id="AddCreditCardInput" class="credit-card-input" >
                <h1>Enter and Save</h1><br/> 
                <h1>Credit Card Information</h1><br/><br/>
                <div class="two-pixel-padding">
                    <label class="top-label">&nbsp;Name on Credit Card</label><span class="required">*</span><br />
                    <input type="text" id="AddCreditCardName" maxlength='30' />
                </div>
                <div class="two-pixel-padding" style="display:none" id="CardTypeToggle">
                    <label class="top-label">&nbsp;Credit Card Type</label><span class="required">*</span><br />
                 	<apex:inputfield  value="{!Order.Chargent_Order__r.ChargentOrders__Card_Type__c}" id="AddCreditCardType"  />
                  </div>
                <div class="two-pixel-padding" >
                    <label class="top-label">&nbsp;Credit Payment Method</label><span class="required">*</span><br />
                 <apex:inputfield value="{!Order.Chargent_Order__r.ChargentOrders__Payment_Method__c}" id="AddPaymentMethod" />
               </div>
                <div class="two-pixel-padding">
                    <label class="top-label">&nbsp;Card Number (16 digits)</label><span class="required">*</span><br />
                    <input type="text" id="AddCreditCardNumber" maxlength="16" />
                </div>
                <div class="two-pixel-padding">
                    <label class="top-label">&nbsp;Card Month (MM)</label><span class="required">*</span><br />
                    <input type="text" id="AddCreditCardMonth" maxlength="2" />
                </div>
                <div class="two-pixel-padding">
                    <label class="top-label">&nbsp;Card Year (YYYY)</label><span class="required">*</span><br />
                    <input type="text" id="AddCreditCardYear" maxlength="4" />
                </div>
                <div class="two-pixel-padding">
                    <label class="top-label">&nbsp;Card Security (XXX)</label><br />
                    <input type="text" id="AddCreditCardSecurity" maxlength="4" />
                </div>
            </div>    
             <div id="AddressInput" class="address-input" >
                <h1>Enter or Select</h1><br/> 
                <h1>Address Information</h1><br/><br/>
                <div><input type="hidden" id="SelectAddressType" /></div>
                <div id="SelectAddressLoading" style="text-align:center;"></div>
                <div id="SelectAddressList" >
                    <table id="SelectAddressListTable" cellpadding="3px" class="select-address-table" />
                </div>  
                                   <div id="AddAddressInput" >
                    <div class="input-container-left">
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;First Name</label><br />
                            <input type="text" id="AddAddressFirstName" />
                        </div>
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;Last Name</label><span class="required">*</span><br />
                            <input type="text" id="AddAddressLastName" />
                        </div>
                    </div><br/>
                    <div class="input-container-left">
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;Address Line One</label><span class="required">*</span><br />
                            <input type="text" id="AddAddressLineOne" />
                        </div>
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;Address Line Two</label><br />
                            <input type="text" id="AddAddressLineTwo" />
                        </div>
                    </div><br/>
                    <div class="input-container-left">
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;City</label><br />
                            <input type="text" id="AddAddressCity" />
                        </div>
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;State</label><br />
                            <input type="text" id="AddAddressState" maxlength="2" size="2" />
                        </div>
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;Zip Code</label><span class="required">*</span><br />
                            <input type="text" id="AddAddressZipCode" maxlength="10" size="10" />
                        </div>
                    </div><br/>
                    <div class="input-container-left">
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;County</label><br />
                            <input type="text" id="AddAddressCounty" />
                        </div>
                        <div class="two-pixel-padding">
                            <label class="top-label">&nbsp;Country</label><br />    
                            <select id="AddAddressCountry" style="width:200px;">
                                <option selected="selected">UNITED STATES</option>
                                <option>AFGHANISTAN</option>
                                <option>?LAND ISLANDS</option>
                                <option>ALBANIA</option>
                                <option>ALGERIA</option>
                                <option>AMERICAN SAMOA</option>
                                <option>ANDORRA</option>
                                <option>ANGOLA</option>
                                <option>ANGUILLA</option>
                                <option>ANTARCTICA</option>
                                <option>ANTIGUA AND BARBUDA</option>
                                <option>ARGENTINA</option>
                                <option>ARMENIA</option>
                                <option>ARUBA</option>
                                <option>AUSTRALIA</option>
                                <option>AUSTRIA</option>
                                <option>AZERBAIJAN</option>
                                <option>BAHAMAS</option>
                                <option>BAHRAIN</option>
                                <option>BANGLADESH</option>
                                <option>BARBADOS</option>
                                <option>BELARUS</option>
                                <option>BELGIUM</option>
                                <option>BELIZE</option>
                                <option>BENIN</option>
                                <option>BERMUDA</option>
                                <option>BHUTAN</option>
                                <option>BOLIVIA</option>
                                <option>BOSNIA AND HERZEGOVINA</option>
                                <option>BOTSWANA</option>
                                <option>BOUVET ISLAND</option>
                                <option>BRAZIL</option>
                                <option>BRITISH INDIAN OCEAN TERRITORY</option>
                                <option>BRUNEI DARUSSALAM</option>
                                <option>BULGARIA</option>
                                <option>BURKINA FASO</option>
                                <option>BURUNDI</option>
                                <option>CAMBODIA</option>
                                <option>CAMEROON</option>
                                <option>CANADA</option>
                                <option>CAPE VERDE</option>
                                <option>CAYMAN ISLANDS</option>
                                <option>CENTRAL AFRICAN REPUBLIC</option>
                                <option>CHAD</option>
                                <option>CHILE</option>
                                <option>CHINA</option>
                                <option>CHRISTMAS ISLAND</option>
                                <option>COCOS (KEELING) ISLANDS</option>
                                <option>COLOMBIA</option>
                                <option>COMOROS</option>
                                <option>CONGO</option>
                                <option>CONGO</option>
                                <option>COOK ISLANDS</option>
                                <option>COSTA RICA</option>
                                <option>C?TE D'IVOIRE</option>
                                <option>CROATIA</option>
                                <option>CUBA</option>
                                <option>CYPRUS</option>
                                <option>CZECH REPUBLIC</option>
                                <option>DENMARK</option>
                                <option>DJIBOUTI</option>
                                <option>DOMINICA</option>
                                <option>DOMINICAN REPUBLIC</option>
                                <option>ECUADOR</option>
                                <option>EGYPT</option>
                                <option>EL SALVADOR</option>
                                <option>EQUATORIAL GUINEA</option>
                                <option>ERITREA</option>
                                <option>ESTONIA</option>
                                <option>ETHIOPIA</option>
                                <option>FALKLAND ISLANDS (MALVINAS)</option>
                                <option>FAROE ISLANDS</option>
                                <option>FIJI</option>
                                <option>FINLAND</option>
                                <option>FRANCE</option>
                                <option>FRENCH GUIANA</option>
                                <option>FRENCH POLYNESIA</option>
                                <option>FRENCH SOUTHERN TERRITORIES</option>
                                <option>GABON</option>
                                <option>GAMBIA</option>
                                <option>GEORGIA</option>
                                <option>GERMANY</option>
                                <option>GHANA</option>
                                <option>GIBRALTAR</option>
                                <option>GREECE</option>
                                <option>GREENLAND</option>
                                <option>GRENADA</option>
                                <option>GUADELOUPE</option>
                                <option>GUAM</option>
                                <option>GUATEMALA</option>
                                <option>GUERNSEY</option>
                                <option>GUINEA</option>
                                <option>GUINEA-BISSAU</option>
                                <option>GUYANA</option>
                                <option>HAITI</option>
                                <option>HEARD ISLAND AND MCDONALD ISLANDS</option>
                                <option>HOLY SEE (VATICAN CITY STATE)</option>
                                <option>HONDURAS</option>
                                <option>HONG KONG</option>
                                <option>HUNGARY</option>
                                <option>ICELAND</option>
                                <option>INDIA</option>
                                <option>INDONESIA</option>
                                <option>IRAN</option>
                                <option>IRAQ</option>
                                <option>IRELAND</option>
                                <option>ISLE OF MAN</option>
                                <option>ISRAEL</option>
                                <option>ITALY</option>
                                <option>JAMAICA</option>
                                <option>JAPAN</option>
                                <option>JERSEY</option>
                                <option>JORDAN</option>
                                <option>KAZAKHSTAN</option>
                                <option>KENYA</option>
                                <option>KIRIBATI</option>
                                <option>KOREA</option>
                                <option>KOREA</option>
                                <option>KUWAIT</option>
                                <option>KYRGYZSTAN</option>
                                <option>LAO PEOPLE'S DEMOCRATIC REPUBLIC</option>
                                <option>LATVIA</option>
                                <option>LEBANON</option>
                                <option>LESOTHO</option>
                                <option>LIBERIA</option>
                                <option>LIBYAN ARAB JAMAHIRIYA</option>
                                <option>LIECHTENSTEIN</option>
                                <option>LITHUANIA</option>
                                <option>LUXEMBOURG</option>
                                <option>MACAO</option>
                                <option>MACEDONIA</option>
                                <option>MADAGASCAR</option>
                                <option>MALAWI</option>
                                <option>MALAYSIA</option>
                                <option>MALDIVES</option>
                                <option>MALI</option>
                                <option>MALTA</option>
                                <option>MARSHALL ISLANDS</option>
                                <option>MARTINIQUE</option>
                                <option>MAURITANIA</option>
                                <option>MAURITIUS</option>
                                <option>MAYOTTE</option>
                                <option>MEXICO</option>
                                <option>MICRONESIA</option>
                                <option>MOLDOVA</option>
                                <option>MONACO</option>
                                <option>MONGOLIA</option>
                                <option>MONTENEGRO</option>
                                <option>MONTSERRAT</option>
                                <option>MOROCCO</option>
                                <option>MOZAMBIQUE</option>
                                <option>MYANMAR</option>
                                <option>NAMIBIA</option>
                                <option>NAURU</option>
                                <option>NEPAL</option>
                                <option>NETHERLANDS</option>
                                <option>NETHERLANDS ANTILLES</option>
                                <option>NEW CALEDONIA</option>
                                <option>NEW ZEALAND</option>
                                <option>NICARAGUA</option>
                                <option>NIGER</option>
                                <option>NIGERIA</option>
                                <option>NIUE</option>
                                <option>NORFOLK ISLAND</option>
                                <option>NORTHERN MARIANA ISLANDS</option>
                                <option>NORWAY</option>
                                <option>OMAN</option>
                                <option>PAKISTAN</option>
                                <option>PALAU</option>
                                <option>PALESTINIAN TERRITORY</option>
                                <option>PANAMA</option>
                                <option>PAPUA NEW GUINEA</option>
                                <option>PARAGUAY</option>
                                <option>PERU</option>
                                <option>PHILIPPINES</option>
                                <option>PITCAIRN</option>
                                <option>POLAND</option>
                                <option>PORTUGAL</option>
                                <option>PUERTO RICO</option>
                                <option>QATAR</option>
                                <option>R?UNION</option>
                                <option>ROMANIA</option>
                                <option>RUSSIAN FEDERATION</option>
                                <option>RWANDA</option>
                                <option>SAINT BARTH?LEMY</option>
                                <option>SAINT HELENA</option>
                                <option>SAINT LUCIA</option>
                                <option>SAINT MARTIN</option>
                                <option>SAINT PIERRE AND MIQUELON</option>
                                <option>SAINT VINCENT AND THE GRENADINES</option>
                                <option>SAMOA</option>
                                <option>SAN MARINO</option>
                                <option>SAO TOME AND PRINCIPE</option>
                                <option>SAUDI ARABIA</option>
                                <option>SENEGAL</option>
                                <option>SERBIA</option>
                                <option>SEYCHELLES</option>
                                <option>SIERRA LEONE</option>
                                <option>SINGAPORE</option>
                                <option>SLOVAKIA</option>
                                <option>SLOVENIA</option>
                                <option>SOLOMON ISLANDS</option>
                                <option>SOMALIA</option>
                                <option>SOUTH AFRICA</option>
                                <option>SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS</option>
                                <option>SPAIN</option>
                                <option>SRI LANKA</option>
                                <option>SUDAN</option>
                                <option>SURINAME</option>
                                <option>SVALBARD AND JAN MAYEN</option>
                                <option>SWAZILAND</option>
                                <option>SWEDEN</option>
                                <option>SWITZERLAND</option>
                                <option>SYRIAN ARAB REPUBLIC</option>
                                <option>TAIWAN</option>
                                <option>TAJIKISTAN</option>
                                <option>TANZANIA</option>
                                <option>THAILAND</option>
                                <option>TIMOR-LESTE</option>
                                <option>TOGO</option>
                                <option>TOKELAU</option>
                                <option>TONGA</option>
                                <option>TRINIDAD AND TOBAGO</option>
                                <option>TTS AND NEVIS</option>
                                <option>TUNISIA</option>
                                <option>TURKEY</option>
                                <option>TURKMENISTAN</option>
                                <option>TURKS AND CAICOS ISLANDS</option>
                                <option>TUVALU</option>
                                <option>UGANDA</option>
                                <option>UKRAINE</option>
                                <option>UNITED ARAB EMIRATES</option>
                                <option>UNITED KINGDOM</option>
                                <option>UNITED STATES MINOR OUTLYING ISLANDS</option>
                                <option>URUGUAY</option>
                                <option>UZBEKISTAN</option>
                                <option>VANUATU</option>
                                <option>VENEZUELA</option>
                                <option>VIET NAM</option>
                                <option>VIRGIN ISLANDS</option>
                                <option>VIRGIN ISLANDS</option>
                                <option>WALLIS AND FUTUNA</option>
                                <option>WESTERN SAHARA</option>
                                <option>YEMEN</option>
                                <option>ZAMBIA</option>
                                <option>ZIMBABWE</option>
                            </select>
                        </div>
                    </div><br/>
                </div>
                                </div> 
                 
        </apex:form> 
           </div>
        <!-- </apex:form> -->
       </body>
        
    </html>
</apex:component>



 
tonante27tonante27
Ok I solved the issue.
I had to remove the DIV tags for the Credit card / Payment Billing info  from th VF Component and place it in the main VF page. Thus the component only has to contain the Address Verification segment. This block of DIVs include both the controlling field  (Payment Type) and the dependent picklist (Credit Type). So when the main VF Page is loaded  it sees the two fields loaded on this page and so no longer throws and error while waiting for the component to load.
This was selected as the best answer