- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 02:43 PM
Hi,
I have a choice fields with 3 values and in total there are 6 fields on a form.
Based on the selection of a choice field, I want the fields on the form to rearrange itself( some fields have to show and others should not be visible) .
I am using setDisplay() method on g_form, but its leaving out some white spaces in between the fields.
Is there a way to rearrange the fields so that there is no white space between the fields?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 10:32 PM
Hey Mary,
This behavior is generally seen when you use setVisible to display/hide the field. if thats the case then you have to replace setVisible with setDisplay in all your scripts.
Also as a best practice try to use UI policy wherever possible.
http://wiki.servicenow.com/index.php?title=Creating_a_UI_Policy
I hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 03:25 PM
Hi May,
Try the setVisible() method instead of setDisplay().
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 04:21 PM
I would also advise you to try using UI Policy when possible rather than client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 07:27 PM
Hello,
I am using UI policy and I have this script, but I am seeing that the fields dont get pushed up or down and empty field space is still visible
g_form.setVisible('u_tableField',false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2016 09:14 PM
Hi Mary,
It should be setDisplay . Wiki says it here GlideForm (g form) - ServiceNow Wiki.
Could you please share the screenshot where the space is not reclaimed with setDisplay.
Mark this response as correct/helpful if it does so
Thanks
Srini