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

still no luck!


i have put the alert in place and its not triggering. can you try hiding the field?



couple of things to highlight:


- it is a catalog client script


- for a particula rcatalog item


- applies on catalog task as well



latest Script:



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


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


      return;


    }




alert('CHECK CHANGE ALERT');



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



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



if (tstate == '-5'){


g_form.setVisible('u_priority_reason', true);


}


   


}


LadySNWizard
Tera Contributor

is the first alert coming?


No, it is not!



i have another script for hiding the same field onLoad which is working fine.


but am trying to make the same field visible onChange it is not working!


LadySNWizard
Tera Contributor

Try changing the order of the Script. Also check if there is any UI Policy for the same field. That might be the issue.


vmeesala
Giga Contributor

check what value you are getting from state, Use log see that


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


if (tstate == '-5'){


g_form.setDisplay('u_priority_reason', true);


}