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

Anil74
Tera Guru

Hello venkatesh,


I tried this above code , but its not working for me.


Replace those fields names   with your field names


Anil74
Tera Guru

Please take a look at below code.


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==None||InProgress){


              g_form.setVisible('feedback',false);


              g_form.setVisible('interviewer',false);


        }


and its showing below error message please see the below screenshot


H1.png


Hi Anil


Replace   if(a==None||InProgress) here with the values for example none witn 1 value and InProgress with 2 like what ever ur giving a value while creating this choices i will show u one image regarding this


Screenshot from 2017-04-14 11_10_01.png


Both LABEL and VALUE different   in choice creation


Anil74
Tera Guru

Hello Kuruva Venkateswarlu,


In Choices i made In Progress sequence as 1 and removed none from drop down list(drop down-without none), then its not showing any error message, but its not hidding the those 2 fields when i select in progress.



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',false);


              g_form.setVisible('interviewer',false);


        }


    //Type appropriate comment here, and begin script below


   


}