Client Script onChange - getReference()

Halo10110
Giga Contributor

Hello, 

I have to compare two reference values from two different tables in onChange client script and am stuck, it works for one, but not sure how to implement the logic to actually compare the values...Any suggestion what is wrong with my script? Please do not tell me that this can be achieved with GlideAjax, I know that but chose this way as it seems easier and more reliable for my case. 

function onChange(control, oldValue, newValue, isLoading) {
	g_form.getReference('u_one_field', validation); 
	g_form.getReference('u_second_field', validation);
}

function validation(demo, show) { // reference is passed into callback as first arguments
	if(demo.active === 'true' && show.u_rule === '2'){
		g_form.showFieldMsg('u_one_field','TEST','info');
	}
}

 

1 ACCEPTED SOLUTION

Thanks it might work, however I fixed it like this (without the callback function)

 

	var demo = g_form.getReference('u_one_field').active;
	var show = g_form.getReference('u_second_field').u_rule;
	if(demo === 'true' && show === '2'){
		g_form.showFieldMsg('u_one_field','TEST','info');
	}

 

Thanks for posting actual helpful answers.

View solution in original post

5 REPLIES 5

glad, you solved it, yes this way you can also fulfill your request. i just answered based on the script you had posted.