- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2016 10:39 AM
Hi all, I'm a bit of a newbie with ServiceNow and am creating a catalog item in which there is (or rather, should be) a button that, when clicked, opens up a pop-up box with some information. I did not want to create an alert or use the already provided "More information" function. I am trying to write a script in my UI macro that would open this dialog window from the button. Here's what I currently have:
<html>
<head>
<script>
window.onload = function() {
var a = document.getElementById("myUIpageName");
a.onclick = function() {
function dialog() {
var dialog = new GlideDialogWindow("myUIpageName"); //Instantiate the dialog containing the UI Page 'add_comments_dialog'
//dialog.setTitle("Eligibility"); //Set the dialog title
//dialog.render(); //Open the dialog
//gs.log('test', 'myUserName');
alert('Test');
}
return false;
}
}
</script>
</head>
<body>
<a id="myUIpageName" class="request_catalog_button" style="width: 150px; height: 25px;">TextOnMyButton</a>
</body>
</html>
Thanks!
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2016 06:39 AM
UI Macro:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<input type="button" onclick="openDialog()" value="Open Dialog" class="selected_action action_context btn btn-primary"/>
<script>
function openDialog(){
var dialog = new GlideDialogWindow("myUIpageName");
dialog.setTitle("Eligibility");
dialog.render();
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2016 10:05 PM
Hi everyone,
I have some problem while submitting the record.
The dialog box is not getting closed when i cancel the form.
Client Script in UI Page:
==================
function onCancel() {
var c = gel('cancelled');
c.value = "true";
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue("comments","hai");
}
Can anyone please help me to solve this.
Thanks,
Kavishree S