Auto populate value based on condition

suuriya
Tera Contributor

Hi 

 

I have requirement where i need to populate values based on condition.

 

In catalog form i have chcek box field when it is select then single line field need to be displayed and readonly i have done using ui policies But "team possible" is the value that needs to be populate in that single line text

How can it be achieved pls provide the onchange script with it

1 ACCEPTED SOLUTION

Sai Kumar B
Mega Sage
Mega Sage

@suuriya 

Write an onChange() client script on the checkbox with the below code

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

	if(isLoading) {
		return;
	}

if(newValue == 'true') { //If checkbox is checked
g_form.setValue('<pass single line text variable name>', 'team possible');
} else {
g_form.clearValue('<pass single line text variable name>'); //If checkbox is empty clear the single-line text variable
}
}

 

View solution in original post

2 REPLIES 2

Sai Kumar B
Mega Sage
Mega Sage

@suuriya 

Write an onChange() client script on the checkbox with the below code

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

	if(isLoading) {
		return;
	}

if(newValue == 'true') { //If checkbox is checked
g_form.setValue('<pass single line text variable name>', 'team possible');
} else {
g_form.clearValue('<pass single line text variable name>'); //If checkbox is empty clear the single-line text variable
}
}

 

Gontla Mythily
Tera Expert

Hi,

 

You can achieve it through catalog ui policy.

 

GontlaMythily_0-1666705190160.pngGontlaMythily_1-1666705209984.png

 

Create one catalog ui policy and give condition("checkbox is true").In UI policy actions make Single line text field visible true and readonly true. And write script to set Single line text value.

 

Mark as correct if it helps
Regards Mythily