- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2016 08:49 AM
Can anyone suggest replacement functions for DOM manipulation technique (e.g., jQuery, Prototype JS($ or $$), gel, document) in Client script and Catalog client scripts
function getParmVal(name){
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
}
else{
return '';
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 04:04 AM
Sample function:
var gURL = new GlideURL();
gURL.setFromCurrent();
alert(gURL.getParam("sysparm_id"));
where sysparm_id is the parameter that needs to be read from URL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 03:00 AM
Hi Sanjeev,
One of the method i know is if i want to add an image beside the caller field, then instead of using dom i can use "g_form.addDecoration" and "g_form.removeDecoration()" methods.
you can use g_form.getControl(), if you want to add background colour to a field.
g_form.getControl("caller_id").style.background-color = "red";
Thanks and regards
Swamy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 03:54 AM
Hi Sanjeev,
you can try the below code to retrieve the URL parameters, without using DOM.
var myParam = getParmVal('sysparm_preview');
function getParmVal(name){
var searchKey=name;
var query = window.location.search.substring(1);
alert("111 "+query);
var vars = query.split('&');
alert("222 "+vars);
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == searchKey) {
return decodeURIComponent(pair[1]);
}
}
Please Mark as Correct or Hit Like or Mark as helpful if Helps
Regards,
Rohini.P

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 04:04 AM
Sample function:
var gURL = new GlideURL();
gURL.setFromCurrent();
alert(gURL.getParam("sysparm_id"));
where sysparm_id is the parameter that needs to be read from URL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 07:52 PM
Is there a alternative way to hide UI macro on form without using DOM manipulation..
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if (newValue =='') {
var x = document.getElementById("callerLinkLocation").style.visibility="hidden";
}
var gr = new GlideRecord('new_call');
gr.query();
if (!gr.next()) {
var y = document.getElementById("callerLinkLocation").style.visibility="hidden";
}
else {
var z = document.getElementById("callerLinkLocation").style.visibility="visible";
}
}