MRVS onsubmit client script

levino
Giga Guru

Hi Team

I have a mrvs , with the below client script which works fine.

e.g it sets the below to the mrvs_description variable.

Item #1:
Dealer_Code : df
Dealer_Name : dfdf
Effective_Date : 09/08/2024
Dealer_Address : ddf
Dealer_Type : Consumer
Hub_Dealer_Code : false
SRS_Dealer_Code : true
Store_Manager : dff

 

I have another requirement where if    Dealer Type == Consumer then setvalue on another variable.

if(dealer_type == 'Consumer'){g_form.setvalue('request_template','test')

}

not sure if the above will work, please help with a onsubmit client script

 

note dealer type is a select box variable type

 

 

function onSubmit() {
	var output = "";
	var variables_names = ['Dealer_Code','Dealer_Name','Effective_Date','Dealer_Address','Dealer_Type','Hub_Dealer_Code','SRS_Dealer_Code','Store_Manager'];
	//get values from the Multirow variables
	var vset_value = g_form.getValue("IO:2db810c7db6d90d0304c147a3a9619c1");
	var json_obj = JSON.parse(vset_value);
	for(var i = 0;  i < json_obj.length; i++){
		output+= "\n"+ 'Item #' + (i+1) + ":\n";
		var row = json_obj[i];
		for(var j = 0; j < variables_names.length; j++){
			if(row[variables_names[j]] != ""){
				output+= variables_names[j] + ' : ' + row[variables_names[j]] + "\n";
			}
		}
	}
	g_form.setValue('mrvs_description', output);
}

 

 

1 ACCEPTED SOLUTION

Hi @levino 

print the log from if condition and check condition matching or not also use actual field name instead of 'request_template' 

View solution in original post

10 REPLIES 10

dealer_type is part of the mrvs