- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 12:27 AM
Hi Community..i need to populate the drop down list based on the another dropdown value.Please help me out.
example: there is drop down called state, if user will select the state(eg:karnataka), then in below drop down i need to display all the district of that state.Please help me in this.Thanjks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 05:43 AM
Hi All
I have done using client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var u_ent = g_form.getValue('u_entity');
alert(u_ent);
if(newValue == 'Austria'){
var dVals = '20,21,22,24,60,70,90';
var dOpts = dVals.split(',');
var myIndex = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < dOpts.length; i++) {
myIndex++;
g_form.addOption('u_tax_code_sub', dOpts[i], dOpts[i], myIndex);
}
}
if(newValue == 'Belgium Sales Company'||newValue == 'Belgium Plant'){
var u_code = 'V0,V1,V2,V3,V4,V5,V6,VA,VB,VC,VD,VE,VF';
var u_split = u_code.split(',');
var myIndex1 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split[i], u_split[i], myIndex1);
}
}
if(newValue == 'Sweden Sales Company'){
var u_code1 = '21,22,23,60,70,80,90';
var u_split1 = u_code1.split(',');
var myIndex2 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split1.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split1[i], u_split1[i], myIndex2);
}
}
if(newValue == 'Spain'){
var u_code2 = 'R0,R7';
var u_split2 = u_code1.split(',');
var myIndex3 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split2.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split2[i], u_split2[i], myIndex3);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 03:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 03:20 AM
Hi Prakash,
You could do it by another way. Try using following steps.
Step 1 - In 1st drop-down field(eg : category in my case) select the value on which your second drop-down field(Subcategory) choices are need to pop up.
in category I have selected the software.
Step 2 - Now right click on the 2nd drop-down field and go to configure choices. And add the choices you want. This choices will only populate when you select software in your first drop-down field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 04:56 AM
Everyone else is correct. So here are some visual aids
1) Create 2 Choice fields, State and District
2) Right-click on the State label and select Configure Choices
3) Populate your list of States
4) Right-click on the label of the District field and select Configure Dictionary
5) In the Related Links list, click Advanced View. This will show the Dependent field tab.
6) Select State in Dependant on field
7) Go back to the form and select the first state in the State field. Then right-click on the label of the District field and select Configure Choices
😎 Populate the Districts for this State. Once complete, go back to the form and select the next state and repeat.
9) Now when you select a State, the values in District will update automatically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 05:43 AM
Hi All
I have done using client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var u_ent = g_form.getValue('u_entity');
alert(u_ent);
if(newValue == 'Austria'){
var dVals = '20,21,22,24,60,70,90';
var dOpts = dVals.split(',');
var myIndex = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < dOpts.length; i++) {
myIndex++;
g_form.addOption('u_tax_code_sub', dOpts[i], dOpts[i], myIndex);
}
}
if(newValue == 'Belgium Sales Company'||newValue == 'Belgium Plant'){
var u_code = 'V0,V1,V2,V3,V4,V5,V6,VA,VB,VC,VD,VE,VF';
var u_split = u_code.split(',');
var myIndex1 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split[i], u_split[i], myIndex1);
}
}
if(newValue == 'Sweden Sales Company'){
var u_code1 = '21,22,23,60,70,80,90';
var u_split1 = u_code1.split(',');
var myIndex2 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split1.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split1[i], u_split1[i], myIndex2);
}
}
if(newValue == 'Spain'){
var u_code2 = 'R0,R7';
var u_split2 = u_code1.split(',');
var myIndex3 = 1;
//housekeeping, clear values in case this is used onchange
g_form.clearValue('u_tax_code_sub');
g_form.clearOptions('u_tax_code_sub');
//Add the standard none option
g_form.addOption('u_tax_code_sub', '-- None --', '-- None --', 1);
for (i = 0; i < u_split2.length; i++) {
myIndex1++;
g_form.addOption('u_tax_code_sub', u_split2[i], u_split2[i], myIndex3);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 05:48 AM
You just rebuilt existing functionality, but made it harder to maintain.