How to set choice values on form

Nag9
Tera Expert

Hi All, I have below business requirement

In my catalog form i have two variables 

1. Target number - which is reference to target table

2. Complaint - as select box(yes/no)

 

 if we select a target number in first variable as TGT1234(inside that " TGT1234 " form we have a field called "complaint " with data as 'test complaint')

 My question is 

if i select a target number in first variable and that number form has complaint field data i need to set the second variable complaint as yes and it should be read only.

 

if i select a target number in first variable and that number form has no complaint field data i need to set the second variable complaint as No and it should be read only.

 

 

How can we achieve this

 

 

 

 

 

14 REPLIES 14

variable u_complaint is of what type?

you want to store this with true/false or yes/no?

 

u_complaint is choice type variable as choices are YES,NO,NA 

 

I want to set YES if complaint field has data over the selected record

else have to set NO

Hi,

then update as this

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

	var number = g_form.getReference('target_number', doAlert);

	function doAlert(number) {
		if(number.u_complaint_num){
			g_form.setValue('u_complaint', 'yes');
			g_form.setReadOnly('u_complaint',true);
		}
		else{
			g_form.setValue('u_complaint', 'no');
		}
		//Type appropriate comment here, and begin script below

	}
}

Regards
Ankur

tried with your script and its not working ankur

Hi,

what debugging you performed?

did you check what value came in the callback method

Regards
Ankur