Fuji client scripts: document object is null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2015 12:39 AM
Hi
We use document.getElementById() or gel() in client scripts to get controls. In some places we cannot replace it with g_form. For example, I need to get a catalog item sys_id in variable set client script so the only way I could do that was document.getElementById("sysparm_id").value
What I found out is that for any client script document object is null:
[Error] TypeError: null is not an object (evaluating 'document.getElementById')
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 12:05 PM
Hi Bobby. In the case I need to hide the reference icon, what would you advise me to use? I can't find anything to manipulate it without using DOM manipulation.
Thks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 12:47 PM
What is the use case? What is the end result you are trying to achieve?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 12:56 PM
I need to hide the reference icon after I completed a field. Previously I solved it with a client script doing this:
document.getElementById('view.u_database_access_matrix').style.display = 'none';
But now when I do that I get the following error:
onChange script error: TypeError: Cannot read property 'style' of null function h_670bfe81c058420087da1d9d5b48a32e(control, oldValue, newValue, isLoading)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 01:22 PM
I understand you want to hide the icon, I was hoping for some insight on why you want to hide it.
Depending on the end result you are after with your overall solution this may be a step you do not need.
If you must hide the icon, a safe way to do so would be to set the field as readonly.
This will not work if the property referenced in the wiki below has been modified.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 05:34 AM
Bobby, we want to hide that field, because it is bringing information from a custom table, and we don't want the customer to see that.
What you proposed hides the magnifying glass icon, not the reference one (the one with the "i"). I'm attaching an image of the icon I want to hide so there's no more confussion about it.
Thanks!