Catalog item

Deepika Ravindr
Tera Contributor
 
1 ACCEPTED SOLUTION

U_Viswa
Mega Sage

Hi Deepika Ravindr,

 

Try with Onsubmit catalog client script.

 

 

function onSubmit() {
	if(!g_form.getValue("var1_name") && !g_form.getValue("var2_name") && !g_form.getValue("var3_name")){
		alert("Fill atleast one field from the below fields\n Variable 1\nVariable 2\nVariable\3");
		return false;
	}else{
		return true;
	}
}

 

 

View solution in original post

5 REPLIES 5

Rahul Talreja
Mega Sage
Mega Sage

Hi @Deepika Ravindr ,

 

You can achieve this by creating 4 client script,

1st client script to make onload and add script to make all 3 fields mandatory.

In next 3 onchange client script in each of the script, just check if field is getting changed and have something added into that, after that you can make other 2 fields not mandatory in the same script.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi @Rahul Talreja ,

Thanks for giving the logic, can I get a script for that? because I tried my side didn't get the proper output.

 

Thanks,

Deepika

U_Viswa
Mega Sage

Hi Deepika Ravindr,

 

Try with Onsubmit catalog client script.

 

 

function onSubmit() {
	if(!g_form.getValue("var1_name") && !g_form.getValue("var2_name") && !g_form.getValue("var3_name")){
		alert("Fill atleast one field from the below fields\n Variable 1\nVariable 2\nVariable\3");
		return false;
	}else{
		return true;
	}
}

 

 

Naga Ravindra R
Kilo Sage

Hi @Deepika Ravindr ,

 

you need to write a onsubmit client script, something below: 

It will check whether all the vaules, in the fields, If all are empty, then it will not allow user to submit.

    var a = g_form.getValue('name_of_the_change');
    var b = g_form.getValue('name_of_the_change_sd');
    var c = g_form.getValue('name_of_the_change_desc');

    if (a == '' && b == '' && c == '') {
        g_form.addErrorMessage("you cannot submit empty form");
        return false;
    }
 
Please mark it as correct, if it helps. Thank you