- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @gokulrovj
@Rafael Batistot is right that true needs to be false to hide the field. But since you mentioned it still shows with false, and the same code works in onChange, it sounds like something is overriding your onLoad script rather than a problem with the code itself.
A few things to check:
- UI Policies on the table. UI Policies run after onLoad client scripts, so a policy that sets u_rov_annual_budget to visible will undo your script. This would also explain why onChange works, because it runs later. Check for any UI Policy action on this field, including ones inherited from a parent table.
- Mandatory. setDisplay(false) won't hide a mandatory field that's empty. Check the dictionary entry and any UI Policies that make it mandatory.
- Script settings. Make sure the script is active, the UI Type is Desktop or All, and it isn't limited to a different view. Check the browser console for errors that might stop the script before this line runs.
The Field Watcher is the quickest way to find the cause. Right-click the field label, choose Watch, and reload the form. It shows every script and policy that touches the field, in order.
For the fix itself, I'd go with Rafael's suggestion: a UI Policy with a Visible = false action, and no client script. If another UI Policy is involved, use the Order field so the right one wins.
Also, use setDisplay rather than setVisible. setVisible(false) hides the field but leaves a blank gap in the layout.