How to setSize for GlideModalForm?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 12:01 AM
I have tried OOB setSize method but it didn't work. Could you please share your inputs or suggestions on how to set Size for GlideModalForm?
Thanks,
Yuva
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 12:34 AM
Hi,
I tried setDialogSize(w,h) but it didnt work.
Thanks,
Yuva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 12:37 AM
The correct way to use it as below
setDialogSize: function(w, h) {
this.setDialogWidth(w);
this.setDialogHeight(h);
},
setDialogWidth: function(w) {
this.dialogWidth = w;
},
setDialogHeight: function(h) {
this.dialogHeight = h;
},
thanks sergiu.panaite
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 01:35 PM
Alas, DOM manipulation is the only way to accomplish a resize with GlideModalForm. If you're going to go in this direction, make sure to use the setOnloadCallback function:
gm.setOnloadCallback(function() {
//I like to remove the page timing div to make the modal cleaner
jQuery("#dialog_frame")[0].contentWindow.jQuery("#page_timing_div").hide();
//Resize the modal window
jQuery(".modal-content").css("width", "50%").css("margin", "0 auto");
});
gm.render()
Of course, that will cause the window to resize after it's already been loaded, which doesn't look great. So if you're going to head down this direction, I would probably inject the css first to avoid seeing the resize at all.
Here's a UI Macro that accomplishes this. (Macros/Formatters are a great way to introduce CSS to forms.)
<span class="btn btn-default icon-add" title="Enter a Task Order" onclick="openNewTaskOrder()" />
<style>
#u_task_order .modal-content { width: 50% !important; margin: 0 auto !important;
</style>
<script>
function openNewTaskOrder() {
var gm = new GlideModalForm('Enter new Task Order', 'u_task_order');
gm.render();
}
</script>