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
‎03-19-2015 08:22 PM
Phooey, I ran into this with my GlideDialogForm. From an Incident, we pop a form that creates a record and we pass the sys_id of the parent incident to the form using g_form.getUniqueValue(). This shows as "undefined" in the field, but hovering over the shows details of the record. However, I think the parent fields in the Incident are not properly accessed in business rules on this new record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 08:41 PM
No, disregard. I'm a moron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2015 11:12 AM
So it also means we will not be able to use Jquery and do any manipulation with form elements? So if we ever want to add some special control on a form we will not be able to do it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2015 11:21 AM
Pavan,
I have noticed that a lot of client script leveraging document.getElementById() are failing after upgrading to Fuji. If it is no longer supported, is there an alternate method to do something such as 4.8.11 from the wiki on client scripts?
4.8.11 Show or hide an action button depending on the form view
function onLoad() {
var objView = document.getElementById('sysparm_view');
var strView = objView.getAttribute('value');
if (strView == 'ess') {
var objCloseButton = document.getElementById('close_incident');
objCloseButton.style.display = 'none';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2015 06:50 AM
Ben,
I am having exactly the same issue. I want to protect (make read-only) two fields on the screen during loading before it is displayed. If this is not the way to go because of future problems, I am also very interested in the answer!
Greg