Client Script that check a variable values before task closure

Davide Calabres
Mega Contributor

Hi All, 

I would like to write a client script that check a select box values before the task closure.

if the value does not correspond to a specific value it is necessary to stop the closure process and show a pop-up.
if the value correspond to a specific value the closure process will continue as well.

Do you have any advice? 

Thanks and regards

Davide

 
 

 

1 ACCEPTED SOLUTION

Hi Periyasamy P, helpful!

 

function onSubmit() {

    if ((g_form.getValue('state') == 3) && (g_form.getValue('<variable name>') == '<variable value>')) {

        g_form.addErrorMessage("<your message>");
        return false;
    }

   }

 

View solution in original post

3 REPLIES 3

Periyasamy P
Tera Guru

You can write client (Type = on submit) script to check your column value, if value is not matching your criteria.

 

function onSubmit() {
   
   if (g_form.getValue("<your column name>") != "<your value>" && g_form.getValue("state")=="<state value>"){

       g_form.addErrorMessage("<your error message>");
       return false;
   }
   
}

  

Hi Periyasamy P, helpful!

 

function onSubmit() {

    if ((g_form.getValue('state') == 3) && (g_form.getValue('<variable name>') == '<variable value>')) {

        g_form.addErrorMessage("<your message>");
        return false;
    }

   }

 

Musab Rasheed
Tera Sage
Tera Sage

Write onSubmit client script with validations and add return false to prevent form getting submitted. Hike like if my answer has helped you.

Please hit like and mark my response as correct if that helps
Regards,
Musab