Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to add new dropdown value based on another text field value

BalaLalitha Gun
Tera Contributor

Hello All,

I have a dropdown field  which is select box in catalog form. When user enters a new value in Text field that value has to be added as new dropdown option in dropdown field. How to achieve this further?

 

Ex: Locations is a select box field with few options. 
There is a Text box field called ID, and when user fills this ID field the value needs to be updated as dropdown field of Location.

 

Kindly help me with this.

 

Thanks

2 REPLIES 2

Manmohan K
Tera Sage

@BalaLalitha Gun 

 

You can create a on change client script on Id field which will add option to location field dynamically

 

Sample code

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

  var inputValue = g_form.getValue('ID');  //enter id field name 

  g_form.addOption("location_field_name",inputValue,inputValue);  //enter location field name

}
}