Revision: 3024
Author:   olavmrk
Date:     Thu Jan 26 23:02:56 2012
Log: 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!
http://code.google.com/p/simplesamlphp/source/detail?r=3024

Modified:
 /trunk/templates/post.php

=======================================
--- /trunk/templates/post.php   Tue Jan 11 02:25:55 2011
+++ /trunk/templates/post.php   Thu Jan 26 23:02:56 2012
@@ -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'];

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to simplesamlphp-commits@googlegroups.com.
To unsubscribe from this group, send email to 
simplesamlphp-commits+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to