Select Box choices dependant on another Select Box

kemmy1
Tera Guru

Can I do this without creating a new table?

I have two variable select boxes.  

The first one has choices A, B and C.

My second select box has choices, but they are dependant on what is selected on Select Box one.

Someone suggested that I add my choices to variable Select Box one (like normal), and then with Select Box two, choose the sys_choice table for "Choice Table" and Value for "Choice Field."

Then go to they sys_choice table and add:

Table: sc_req_item

Element: (my select box one field)

Lable: the label of one of my select box two choices

Value: the value of one of my select box two choices

depends on: the choice of on of the select box one choice.

and keep adding for each select box 2 choice.

Unfortunately this is not working.   Am I missing something?   Or is the only way to do this is with a table and a client script?

19 REPLIES 19

Community Alums
Not applicable

Hi booher,

Correction-> Remove the 's' i.e. use addOption not addOptions.

Thanks & Regards,

Anjali

This worked great for me, thank you for posting!

Hi i tried using the same code in my account but invain its not working

var num = g_form.getValue('number');


g_form.addInfoMessage('NUM :: ' + num); // just so that we see what Value num realy has.

g_form.clearOptions("alphabet");
if ( num == "aa"){
g_form.addOption("alphabet","80","11");
}
else if ( num == "bb"){
g_form.addOption("alphabet","90","22");

}
}

 

can you help

Try this:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == ''){
return;
}

var num = g_form.getValue('number');

g_form.addInfoMessage('NUM :: ' + num); // just so that we see what Value num realy has.

if(num == "aa"){
g_form.clearOptions('alphabet');
g_form.addOptions('alphabet', '80', '11');
}
else if(num == "bb")
g_form.clearOptions('alphabet');
g_form.addOptions('alphabet', '90', '22');
}

Hii @kemmy1 

 

we have same requirement 

but script is not working - can you plsease see the script - if we did any mistake - let me know

babbi_0-1667566151938.png

 

Thanks