if statement needs to evalutate checkboxes

levino
Giga Guru

Hi Team

 

basically if select box is not sap then users need to select atleast one checkboxe ' ccl,ccz,other ,entelar'

 

Please help me to fix my script 

 

Thank You

Levino

 

function onSubmit() {
   //Type appropriate comment here, and begin script below
   var entelar = g_form.getValue('entelar_egl');
   var other = g_form.getValue('other');
   var ccl = g_form.getValue('ccl');
   var ccz = g_form.getValue('ccz');
   var request = g_form.getValue('request_type');
   if((request != 'SAP Read-only') &&  (ccl == 'false' || ccz == 'false' || entelar == 'false' || other == 'false')){
	g_form.addInfoMessage("please make a selection");
		return false;
   }
}

 

1 ACCEPTED SOLUTION

@levino 

 

The condition needs to be tweaked so that it could check if at least one checkbox is checked. As of now, it is checking for all the checkboxes to be checked. Try with the condition as :

 

if((request != 'sap_read_only') &&  (ccl == 'false' && ccz == 'false' && entelar == 'false' && other == 'false'))

Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

8 REPLIES 8

levino_1-1722844089432.png

 

@levino 

 

Is it not working on Service Portal or on Service Portal and Native UI Both ? If Service Portal, check if you have configured the On-Submit Client Script to run on all by selecting UI Type as All

 

AmitVerma_0-1722847612961.png

 


Please mark this response as correct and helpful if it assisted you with your question.

Hi Amit 

i had selected  ui type as all.

 

is my script ok,  the and or condition

 

Thanks

Levino

@levino 

 

The condition needs to be tweaked so that it could check if at least one checkbox is checked. As of now, it is checking for all the checkboxes to be checked. Try with the condition as :

 

if((request != 'sap_read_only') &&  (ccl == 'false' && ccz == 'false' && entelar == 'false' && other == 'false'))

Please mark this response as correct and helpful if it assisted you with your question.