diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-16 16:29:59 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-16 16:29:59 +0000 |
commit | 4c3c68ac10161e37804b76e640c0d3893b7389bd (patch) | |
tree | 8f2677c3cf3cede3f0d5b15f9c59ec0f4e77225a /themes/default/js/ui.init.js | |
parent | a0e07764c14ef5567a0f9375ecb03951fdc89b27 (diff) |
Add Submit and Reset buttons to the dialog in order to trap the form submission so the form doesn't close. There might be a better way, but i couldn't think of it.
Diffstat (limited to 'themes/default/js/ui.init.js')
-rw-r--r-- | themes/default/js/ui.init.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 76c0fbd9..53c47e36 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -71,6 +71,19 @@ function openDialog(element) { var eDialog = '<div id="gDialog"></div>'; $("body").append(eDialog); + var buttons = {}; + buttons["Submit"] = function() { + var form = $("#gDialog").find("form"); + $.post(form.attr("action"), form.serialize(), + function(data, textStatus) { + form.html(data); + }, "html"); + } + buttons["Reset"] = function() { + var form = $("#gDialog").find("form"); + form[0].reset(); + } + $("#gDialog").dialog({ autoResize: false, draggable: true, @@ -83,6 +96,7 @@ function openDialog(element) { resizable: true, title: sTitle, width: 600, + buttons: buttons, close: function (event, ui) { $("#gDialog").dialog('destroy').remove(); } |