Apex Code:
public class sample
{
public String state {get;set;}
public String city {get;set;}
public List<SelectOption> getStates()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None','--- None ---'));
options.add(new SelectOption('TN','Tamil Nadu'));
options.add(new SelectOption('KL','Kerala'));
return options;
}
public List<SelectOption> getCities()
{
List<SelectOption> options = new List<SelectOption>();
if(state == 'TN')
{
options.add(new SelectOption('CHE','Chennai'));
options.add(new SelectOption('CBE','Coimbatore'));
}
else if(state == 'KL')
{
options.add(new SelectOption('COA','Coachin'));
options.add(new SelectOption('MVL','Mavelikara'));
}
else
{
options.add(new SelectOption('None','--- None ---'));
}
return options;
}
}
Visualforce page:
<apex:page controller="sample">
<apex:form >
<apex:pageBlock>
<apex:pageBlockSection columns="2">
<apex:pageblockSectionItem>
<apex:outputLabel value="State"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:selectList size="1" value="{!state}">
<apex:selectOptions value="{!states}"/>
<apex:actionSupport event="onchange" reRender="a"/>
</apex:selectList>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:outputLabel value="City"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:selectList size="1" value="{!city}" id="a">
<apex:selectOptions value="{!cities}"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class sample
{
public String state {get;set;}
public String city {get;set;}
public List<SelectOption> getStates()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None','--- None ---'));
options.add(new SelectOption('TN','Tamil Nadu'));
options.add(new SelectOption('KL','Kerala'));
return options;
}
public List<SelectOption> getCities()
{
List<SelectOption> options = new List<SelectOption>();
if(state == 'TN')
{
options.add(new SelectOption('CHE','Chennai'));
options.add(new SelectOption('CBE','Coimbatore'));
}
else if(state == 'KL')
{
options.add(new SelectOption('COA','Coachin'));
options.add(new SelectOption('MVL','Mavelikara'));
}
else
{
options.add(new SelectOption('None','--- None ---'));
}
return options;
}
}
Visualforce page:
<apex:page controller="sample">
<apex:form >
<apex:pageBlock>
<apex:pageBlockSection columns="2">
<apex:pageblockSectionItem>
<apex:outputLabel value="State"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:selectList size="1" value="{!state}">
<apex:selectOptions value="{!states}"/>
<apex:actionSupport event="onchange" reRender="a"/>
</apex:selectList>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:outputLabel value="City"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem>
<apex:selectList size="1" value="{!city}" id="a">
<apex:selectOptions value="{!cities}"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks a lot for sharing that useful information. That was a really Intresting post and I would really like to know more.
ReplyDeletesalesforce development company
Salesforce development services
Salesforce Consultant
Good article - Lexicon Infotech a Salesforce registered consulting partner
ReplyDeleteWell Post! Thank you so much for sharing this make attractive post, it was so nice to read and useful to improve myself knowledge as updated one, keep blogging
ReplyDeleteSaleforce Admin Training in Electronic City
Find Here Best Salesforce Certification Sample Papers, Platform Developer 1 Dumps, We are Providing Salesforce Sample Questions, Salesforce Dumps, Service Cloud Sample Papers, Sales Cloud Sample Papers, We have online courses for Salesforce Administrators as well as Developer Certification. Details of the same are available.
ReplyDeleteBundle Offer 2020:
We are new offering. Buy any two papers and get third free. Offer available for for all courses available online. You can pick and choose certifications which are relevant to you and complete the certifications at your pace.
More Info: http://www.salesforcecertifications.com/
Very well written article. It was an awesome article to read
ReplyDeleteSalesforce Integration Services
Thanks for sharing post. It is easy to understand to create dynamic dependent picklist of objects in Salesforce.
ReplyDeleteSalesforce Integration Services
Thanks a lot for explaining practically.
ReplyDeleteReally Appreciable!
Admin Guide to Export Field Permissions for Permission Sets using BOFC
Nice article!
ReplyDeleteI found many useful information in your blog, it was awesome to read,thanks for sharing this great content, keep sharing..
Create Multiple Validation Rules for multiple objects
This post is really nice and informative. The explanation given is really comprehensive and informative.
ReplyDeleteSalesforce App Development
ReplyDeleteThanks, this is generally helpful.
Still, I followed step-by-step your method in this salesforce cpq online training
salesforce cpq course
Thanks for sharing this Information. Salesforce Course in Gurgaon
ReplyDelete360degreecloud is a certified Salesforce ISV partner that has years of experience in successfully developing and integrating Salesforce solutions for clients from all over the world. Moreover, team consists of certified professionals who have years of experience behind their back.
ReplyDeletevisit-360degreecloud
buy online ambien 10mg
ReplyDeletebuy online xanax 1mg
ReplyDeletebuy online cialis 10mg
ReplyDeleteThanks for sharing post. It is easy to understand Salesforce through this post.To know more about Salesforce Visit Webnersolutions!
ReplyDelete"With more than 8 years of experience in Salesforce support, Sales Cloud services we’re the Salesforce Implementation Partner of choice to meet business needs. 360 Degree Cloud is a Salesforce Certified Consulting Partner that
ReplyDeleteoffers Salesforce Consulting, Implementation and Integration services"
visit-360degreecloud
Salesforce Training in Delhi
ReplyDeleteI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.
ReplyDeleteCPQ Sales Force Training
Visit us: sales force CPQ Online Training
Thanks for sharing this Informative content. Well explained. Got to learn new things from your Blog.
ReplyDeleteChoose ACAP, the top-rated Salesforce development company for small businesses. ACAP’s certified Salesforce developer consultants specialize in customization, migration and integration of award-winning, affordable solutions.
this blog is beneficial and great information to share with us. Iqra Technology is an IT Solutions and Services Company more information visit to our web site iqratechnology
ReplyDeletehire-salesforce
salesforce-admin
salesforce-development
MR Reporting Mobile App is now even more user friendly ensuring a delightful experience on mobile while Tracking DCR, TP, Expense status viewing and much more. CBO ERP Ltd provides best reporting software for pharma and MR/ Online Mobile MR Reporting software, Some Key Features Of “Pharma Mobile/Tablet MR Reporting Software” are as under:
• Easy and fast reporting.
• Acute & error free.
• No waiting for the salary process.
• No waiting for expense data.
• No need to carry a visual aid inbuilt detailing system.
• Non submitted DCR information by SMS to H.O. / Managers.
https://www.cboerp.com/mr-reporting-software.php