Catalog client Script for field visibility

mayurbaligar
Kilo Contributor

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

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

        // return;

    }

var tstate=g_form.getValue(state);

if (tstate == '-5'){

g_form.setVisible('u_priority_reason', true);

}

   

}

why isnt the above working?

- i have made u_priority_reason hidden onload

- i want To make it visible when the dropdown value of state is -5

9 REPLIES 9

kamalsoni
Tera Expert

Hi,



Please use the below code.



var tstate=g_form.getValue('state');



if (tstate == -5){


g_form.setVisible('u_priority_reason', true);


}


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


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


        // return;


    }




var tstate=g_form.getValue('state');



if (tstate == -5){


g_form.setVisible('u_priority_reason', true);


}


   


}



this is not working too !


Have you checked what value you are getting in tstate ?


var tstate=g_form.getValue('state');


Hi,



I did this to hide the 'cost' field if the price frequency selected from dropdown is 'monthly' and it is working fine for me.



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


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


          return;


    }


var tstate=g_form.getValue('recurring_frequency');


alert('tstae>>>'+tstate);


    //Type appropriate comment here, and begin script below


    if(tstate=='monthly')


    {


    g_form.setVisible('cost',false);


    }