How to hide a field in widget??

gokulraj
Giga Expert

Hello Team,

find_real_file.png

I want to hide the "Justification" field when the "Requested for" field is empty. But this is widget how to do this??

8 REPLIES 8

you are saying to set the <div id> for requested for or justification??

Yes and write below code in client side script

Chuck Tomasi
Tera Patron

If both fields are mandatory, why do you want to hide one since the other is empty?

I invite you to check in to the ng-if parameter for AngularJS which makes the HTML conditional. While I haven't done something exactly like this you could try something like:

<input name="justification" ng-if="c.data.requester!=''">

Note, this code is highly untested, but should give you the idea where to start.

W3Schools.com - AngularJS ng-if TryIt Editor

 

find_real_file.png

 

Based on my requirement I am returning a  "true"  or "false" value from my server side to client side in widget editor.

If the return value is "true" means,

I have to hide the "Purpose " field,

Else the return value is "false" means,

I have to hide the "Justification" field,

This return function will work only they select the "Requested for" field,

So Initially I want to hide the both "Purpose " and "Justification" field