From 97f38bcd30eb2103d59213f9ff49aff3a44905ce Mon Sep 17 00:00:00 2001 From: msgilligan Date: Mon, 28 Sep 2009 15:58:05 -0700 Subject: [PATCH] Fixes to enable forms with target="_self" to be submitted normally (no Ajax) --- iui/iui.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/iui/iui.js b/iui/iui.js index f27041a..268eaba 100644 --- a/iui/iui.js +++ b/iui/iui.js @@ -276,7 +276,13 @@ addEventListener("click", function(event) } else if (link.getAttribute("type") == "submit") { - submitForm(findParent(link, "form")); + var form = findParent(link, "form"); + if (form.target == "_self") + { + form.submit(); + return; // allow default + } + submitForm(form); } else if (link.getAttribute("type") == "cancel") { @@ -393,16 +399,25 @@ function showDialog(page) currentDialog = page; page.setAttribute("selected", "true"); - if (hasClass(page, "dialog") && !page.target) + if (hasClass(page, "dialog")) showForm(page); } function showForm(form) { +// +// Walking through this code on 9/28 shows that neither +// submitForm or cancelDialog is called here, but +// submitForm seems to be called elsewhere and so does +// removeAttribute("selected") +// form.onsubmit = function(event) { - event.preventDefault(); - submitForm(form); +// submitForm and preventDefault seem to be called in the click handler +// so we don't need to call them again here +// +// event.preventDefault(); +// submitForm(form); }; form.onclick = function(event)