How to set string field value based on choice field type

sriram7
Tera Contributor

Hi,

 

Field 1(Issue) Choice Field:  Mobile Issue, CPU Issue.

 

Field 2: based on choice selection in filed 1,  fields 2 value should populate.

 

EX: in Field 1 I have selected Mobile Issue,  in Field 2 it should populate "Describe the issue"

 

in Field 1 I have selected CPU Issue,  in Field 2 it should populate "CPU not working".

 

 

5 REPLIES 5

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

Using OnChange client script you can set the values of field2. Write code like below.

 

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

if (newValue == "Mobile Issue")

{
g_form.setValue("field2 name", "Describe the issue");

}
else if (newValue == "CPU not working")

{
g_form.setValue("field2 name", "CPU not working");

}

 

Please mark my answer as helpful/correct if it helps you.

Regards,

Namrata