value changes based on the other field

Prati2
Tera Contributor

Hi Team,

I want have two fields on form one is choice field and other is the lit collector field, based on the choice i have selected in choice field the other field which has type as list collector should show the options. I have created on change client script to achieve this i can see script is entering into the condition, but it is not reflecting options for second field which has type list collector based on the option selected from 1st field whose type is choice field.

 

can anyone help me on this?

 

thank you

8 REPLIES 8

Ademir Amaral1
Kilo Sage

Hi @Prati2 

Can you provide the script for us to evaluate?

Prati2
Tera Contributor

below is the sample script:-

here 1st field which i choice field is selected in onchange script.

2nd field is list collector type
var ga=g_form.getValue('applicationname');

if(newValue=='A'&& ga=='sys_id'){

g_form.addoption('second field','test','test');

}

Hi @Prati2 ,

 

If you are using below format of addOption:

addOption(String fieldName, String choiceValue, String choiceLabel, Number choiceIndex)

Adds a choice to the list field at the position specified.
 
Then your line "g_form.addoption('second field','test','test');" syntax is wrong "O" should be capital "addOption". Not sure if this will work but that is one issue I can see.

Prati
Tera Contributor

can you give example of this one coz when i tried its not working.

addoption(String fieldname, String choice Value, String choice Label, Number choice Index)