How to hide the fields on form

Anil74
Tera Guru

Hi All,

Can anyone help me out how to hide fields on form using java script.

Hide.png

If the user selects None or In progress choices from the Internal Interview drop down, then hide Feedback and Interviewer fields which are highlighted in the red color.

i have tried with below code but its not working for me

g_form.setDisplay('Interviewer', false);

g_form.setDisplay('Feedback', false);

thanks

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Hi Anil,



You need to write a UI policy on the Table with condition as Initial Interview is None OR Initial Interview is In Progress and Add 2 new UI policy actions for the fields Feedback and Interviewer. On the UI policy action for 2 fields, set Visible to false to accomplish your requirement.



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

20 REPLIES 20

Hi Anil


Try this


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


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


          return;


    }


var a=g_form.getValue('internal_interview');//give ur field value here


      if(a==1){


              g_form.setVisible('feedback',true);//give ur field value here


              g_form.setVisible('interviewer',true);//give ur field value here


alert('some felds hide');


      }


        }


Hi Anil, code looks good but are your field names correct? Can you right click on the field and click "Show" Fieldname..Are they really feedback and interviewer?


Anil74
Tera Guru

Hi Regina,



yeah both fields names are correct.


Anil74
Tera Guru

please see the below screenshot


H3.png


then in the case, take note what the new value is displaying then use it   in your condition.



try this:



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


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


          return;


    }



alert('newValue' + newValue);



      if(newValue==1){


              g_form.setVisible('feedback',false);


              g_form.setVisible('interviewer',false);


        }


    //Type appropriate comment here, and begin script below



}