Skip to content

Commit

Permalink
Fixes to enable forms with target="_self" to be submitted normally (n…
Browse files Browse the repository at this point in the history
…o Ajax)
  • Loading branch information
msgilligan committed Sep 28, 2009
1 parent c531387 commit 97f38bc
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions iui/iui.js
Expand Up @@ -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")
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 97f38bc

Please sign in to comment.