The CreatorCon Call for Content is officially open! Get started here.

Client Script for Error Message

aubreysallee
Kilo Contributor

Hi I'm trying to write a client script to make an error message when the "Portfolio" field is changed to "AIT" and the choice field below it (A question about   being submitted on behalf of a Business Partner) has not be answered already. This is the script I have so far, but it is not working. The commented out part I'm not sure if I need or not, I had it originally but was trying to see if it would work without it. Any ideas would be very appreciated!

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    //if (isLoading || newValue === '') {
        // return;
    //}

if(g_form.getValue('portfolio')=='AIT'
  && g_form.getValue('u_choice_1')==''){

  g_form.addErrorMessage('Please answer "Business Partner" Question');

  }

}

11 REPLIES 11

Hi Aubrey,



This is choice field so it will work the usual way



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


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


          return;


    }



    //Alert telling user to update portfolio based on the business partners business group/department


  if(g_form.getValue('u_choice_1')==1){


          g_form.alert("Please update the Portfolio to represent the Business Partner's Business Group/Department");


  }


}




Just make sure that in choice of u_choice_1 'YES' has the value 1


-Anurag

Also, please mark the post answered if your query is resolved.


-Anurag