Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.8

Bug #8358 formSubmit gives error in IE fields named 'action'
Submitted: 2006-08-04 10:40 UTC
From: gapfontaine at gmail dot com Assigned: arpad
Status: Closed Package: HTML_AJAX (version 0.4.1)
PHP Version: 4.4.1 OS: *
Roadmaps: (Not assigned)    

 [2006-08-04 10:40 UTC] gapfontaine at gmail dot com (Guillaume Fontaine)
Description: ------------ In IE (my version: 6.0.2800), formSubmit(this, 'target') gives an error if one of the input fields is named 'action'. I guess because of <form action='script.php ...> ? Firefox doesn't have this issue. See example code. The example uses a submit button named 'action' but the same thing happens if it's a hidden or text input field. Using another name instead of 'action' such as 'act' or 'task' solves the problem. This is a pain because all of my scripts use $action to determine what to do :) Test script: --------------- <?php if( $_REQUEST["action"]=="go" ) { var_dump( $_REQUEST ); exit(0); } ?><html> <head> <script type="text/javascript" src="server.php?client=all&stub=all" language="JavaScript"></script> </head> </body> <pre id="target"> </pre> <form action="rpcTest.php" method="post" onSubmit="return !HTML_AJAX.formSubmit(this, 'target');"> <input type="text" name="text" value="some text"> <input type="submit" name="action" value="go"> </form> </body> </html> Expected result: ---------------- The name of the form input fields should not affect functionality. Actual result: -------------- Error from IE: Line: 1722 Char: 9 Error: HTTP Error Making Request: [404] Not found Code: 0 URL: (my script url, which is there!)


 [2006-08-04 12:22 UTC] gapfontaine at gmail dot com
I saw a previous post where var action = form.action; is changed to var action = for.getAttribute('action'); This works with FF but still gives an error in IE.
 [2006-08-04 15:33 UTC] gapfontaine at gmail dot com
After some trial and error with FF and IE, it seems that this works: var action = form.attributes['action'].value; instead of var action = form.getAttributes('action');
 [2006-08-04 18:31 UTC] arpad (Arpad Ray)
Thanks for the report & fix, it's now in SVN.