The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Display Field Message

Blaze2
Kilo Guru

I want to display a message when the user selects I am not sure.

find_real_file.png

Currently the message displays no matter which choice is made

find_real_file.png

I am not sure how to select the choice that I want so that the message populates.

This is the script that I am using

find_real_file.png

function onChange(control, oldValue, newValue, isLoading) {

    if (isLoading || newValue == '') {

          return;

    }

  //Type appropriate comment here, and begin script below

    g_form.showFieldMsg('why_form_needed','If you are not sure why the form is needed, please verify with supervisor','info');

}

Finally I want to deny submitting the form until that choice changes to New Form or Update existing form.

1 ACCEPTED SOLUTION

function onChange(control, oldValue, newValue, isLoading) {


    if (isLoading || newValue == '') {


          return;


    }



if(g_from.getValue("why_form_needed")=="actual value of select box choice"){


  //Type appropriate comment here, and begin script below


    g_form.showFieldMsg('why_form_needed','If you are not sure why the form is needed, please verify with supervisor','info');


return false;


}



}




please try the above code and replace the "actual value of select box choice" of "I am not sure" question choice in   the variable "why_form_needed".



Let me if this helps.



Thanks


Gaurav


View solution in original post

7 REPLIES 7

Gaurav Bajaj
Kilo Sage

Hi,


Before the showfieldmsg line,you have to check the value of variable selcted by end user.


I.e. g_form.getvalue('why_form_needed').


If it comes out to be "i am not sure" then only showfieldmsg should run.


Try adding it in if condition and return false in the end to stop it from submitting.



Let me know if it works for you or i can provide the entire code.



Thanks


Gaurav


I tried this with no luck .



function onChange(control, oldValue, newValue, isLoading) {


    if (isLoading || newValue == '') {


          return;


    }




  //Type appropriate comment here, and begin script below


    g_form.getvalue("I am not sure");


    g_form.showFieldMsg('why_form_needed','If you are not sure why the form is needed, please verify with supervisor','info');




}


function onChange(control, oldValue, newValue, isLoading) {


    if (isLoading || newValue == '') {


          return;


    }



if(g_from.getValue("why_form_needed")=="actual value of select box choice"){


  //Type appropriate comment here, and begin script below


    g_form.showFieldMsg('why_form_needed','If you are not sure why the form is needed, please verify with supervisor','info');


return false;


}



}




please try the above code and replace the "actual value of select box choice" of "I am not sure" question choice in   the variable "why_form_needed".



Let me if this helps.



Thanks


Gaurav


I verified the value as "unsure"


find_real_file.png



Modified the script I believe as you instructed.


find_real_file.png


Still not getting the result


find_real_file.png