Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

GetValue and setValue

ashleygreens
Giga Contributor

Folks, looking forward for suggestions.

Variable in catalog item has some value, onChange of the field value, i should get the value and then append % to same field and getting error "Out of stack space function.

 

XXX

1 ACCEPTED SOLUTION

Allen Andreas
Tera Patron

Hi,

Please share your script...

But it should look something like:

var step1 = newValue;
var step2 = step1 + "%";
g_form.setValue('field_name', step2);

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

2 REPLIES 2

Allen Andreas
Tera Patron

Hi,

Please share your script...

But it should look something like:

var step1 = newValue;
var step2 = step1 + "%";
g_form.setValue('field_name', step2);

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Shishir Srivast
Mega Sage

I think, you can try something like this.

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

	//Type appropriate comment here, and begin script below
	var val = newValue;
	var appended_val = val + "%";
	if(g_form.getValue('variable_name').indexOf('%') == -1)
		g_form.setValue('variable_name', appended_val);
}