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
Nagma KhanNagma Khan 

how to slove the dependent pic list on visualforce page ??

hi
Please support me

question =>  i have a dependend pic list country and city when select the India then showing all India City and when i select the the ctiy name delhi then automatically pop up form for filling information delhi person
how to slove this problem pelase support me with simple code ? and idea
Akshay_DhimanAkshay_Dhiman
Hi Nagma,

For field dependencies follow the points :
  • Open the Custom object
  • Click on view fields.
  • In (Custom Fields & Relationships) - > Click Field Dependencies -> Click New .
  • In controlling field , select COUNTRY & and In Dependent field select CITY.
  • Include the values in which you want to add.
  • Done !
  • Below is the vf code for the for showing in the Visualforce Page and showing the popup on changing the city.
  • Add the fields accordingly in the pop up . (I have used only 2 field).
  • I have written the code for the Custom Object (Test) using standard controller. Change the Object and field Accordingly.
Hope it helps you !

Visualforce Code :
 
<apex:page standardController="Test__c">
<apex:slds>
<apex:form id="form">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
       <apex:includeScript value="https://code.jquery.com/jquery-2.1.4.min.js"/>
       <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"/>
       <link rel="stylesheet"
             href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css"
             type="text/css" media="all"/>
      <script type="text/javascript">  
  function javafunction()
  {
   $("#InputPopup").show();
}
  </script>
</head>
<div id="popup-form">
       <apex:pageBlock title="Edit Contact" id="pageblock">
<apex:pageBlockSection columns="1" id="pageblocksection">
               <apex:inputField value="{!Test__c.Name}"/>
               <apex:inputField value="{!Test__c.Country__c}"/>
               <apex:inputField value="{!Test__c.CITY__c}" onchange="javafunction();"/>
           </apex:pageBlockSection>
       </apex:pageBlock>
   </div>
   <div class="slds" id="InputPopup" style="display: none" >
<div class="demo-only" style="height: 640px;">
<section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<header class="slds-modal__header">
<button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
<!-- <svg class="slds-button__icon slds-button__icon_large" aria-hidden="true">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close" />
</svg> -->
<span class="slds-assistive-text">Close</span>
</button>
<h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">User Details</h2>
</header>
<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
<div class="slds-form-element">
 <label class="slds-form-element__label" for="text-input-id-1">User Name</label>
 <div class="slds-form-element__control">
   <input type="text" id="text-input-id-1" class="slds-input" placeholder="enter username" />
 </div>
</div>
<div class="slds-form-element">
 <label class="slds-form-element__label" for="text-input-id-1">Password</label>
 <div class="slds-form-element__control">
   <input type="text" id="text-input-id-1" class="slds-input" placeholder="enter Password" />
 </div>
</div>
</div>
<footer class="slds-modal__footer">
<button class="slds-button slds-button_neutral">Cancel</button>
<button class="slds-button slds-button_brand">Save</button>
</footer>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>
</div>
          </div>
       
</apex:form>
</apex:slds>      
</apex:page>

SCREENSHOT :

User-added image

User-added image


Regards,
Akshay
Nagma KhanNagma Khan
hi Akshay

yes, its fine but when i select the other citry then how to come new form for new city ??? please describe
when i select the delhi then form come for delhi when i select the MP then form come for MP ........................ pelase support