From fee5bf7590ce02e2952aa812c18ddb772d98350d Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 27 Jan 2012 07:02:56 +0000 Subject: [PATCH] Fix "post-redirect" not working when one of the parameters is named "submit". It appears that there is some special processing of elements named "submit" when triggering form-submit through javascript. This patch adds a workaround for that. Thanks to Christian Gijtenbeek for finding and fixing this bug! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3024 44740490-163a-0410-bde0-09ae8108e29a --- templates/post.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/post.php b/templates/post.php index 7b5c4b60d..323c39cea 100644 --- a/templates/post.php +++ b/templates/post.php @@ -5,13 +5,17 @@ <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>POST data</title> </head> -<body onload="document.forms[0].submit()"> +<body onload="document.getElementsByTagName('input')[0].click();"> <noscript> <p><strong>Note:</strong> Since your browser does not support JavaScript, you must press the button below once to proceed.</p> </noscript> <form method="post" action="<?php echo htmlspecialchars($this->data['destination']); ?>"> + <!-- Need to add this element and call click method, because calling submit() + on the form causes failed submission if the form has another element with name or id of submit. + See: https://developer.mozilla.org/en/DOM/form.submit#Specification --> + <input type="submit" style="display:none;" /> <?php if (array_key_exists('post', $this->data)) { $post = $this->data['post']; -- GitLab