This project is archived and is in readonly mode.

#691 ✓duplicate
grazius

very strange bug on form submit under IE7

Reported by grazius | June 18th, 2009 @ 07:25 PM | in 1.3.0 rc2 (closed)

Hi,
i've got a very strange bug under IE7.
if u make a form with an hidden input with the id = 'action' the form could not be submited ... javascript error !

'action' is not a reserved word ?

 <script type="text/javascript">
    //<![CDATA[
    
    window.addEvent("domready", function(){

        //send form
        $('myForm').addEvent('submit',function(event){
            // block
            event.stop();

            // submit return
            this.set('send', {
                onComplete: function(response) {
                    alert('ok');
                }
            });
            
            // send the form
            alert('send binded');
    
            //Send the form.
            this.send();
    
            alert('form sended');
        });
    });

    //]]>
    </script>
    
    <form id="myForm" name="myForm" method="post" action="myaction.php" enctype="multipart/form-data">
        <input id="action" name="action" value="myaction" type="hidden" />
        <input id="visiblefield" name="visiblefield" value="value2" type="text" />
        <input id="bt" type="image" value="test" />
    </form>

Comments and changes to this ticket

  • grazius

    grazius June 18th, 2009 @ 07:27 PM

    same effect if u remove enctype="multipart/form-data"

  • grazius

    grazius June 19th, 2009 @ 09:06 AM

    More worrying !

    if u put this after the form.send(), action property 'action' is null !!!

    // send the form
    alert(this.getProperty('action'));
    
  • grazius

    grazius June 19th, 2009 @ 09:07 AM

    ... hummmm put it before the send not after

  • Fábio M. Costa

    Fábio M. Costa June 19th, 2009 @ 01:02 PM

    • Assigned user set to “Christoph Pojer”

    An input with name 'action' is not ok since ie will overwrite existing action property from the form.

    i mean $('form-id').action normaly returns the action attribute from the form, but in your case it will return the input with name 'action', because ie works like this. Try use another name to avoid this problem.

    In fact there is a way to fix this and ill try to send the patch when i got time.
    This can be set to hold.

  • grazius

    grazius June 19th, 2009 @ 02:26 PM

    Thanks for the response.

    I work actually on integration of mocha-ui on differents system :

    php (extra work) : On "oscommerce" manager and all 'action' are passed in hidden field name 'action'.
    java (real job) : It's the same think but on a very big application.

    For my extra work i can wait but for my real job this problem have a real cost (in money).

    It's an IE bug or a Mootools bug (for IE) ?

  • Christoph Pojer

    Christoph Pojer June 19th, 2009 @ 06:43 PM

    • State changed from “new” to “invalid”

    This is a known bug in Internet Explorer, therefor we cannot fix it :( The solution is not to use fields with a name like "action", "method" or other properties.

  • Fábio M. Costa

    Fábio M. Costa June 20th, 2009 @ 03:45 AM

    No!!

    Zilence in fact this can be fixed. It is a IE bug but can be fixed.

    Element.Properties.send = {
        set: function(options){
            var send = this.retrieve('send');
            if (send) send.cancel();
            return this.eliminate('send').store('send:options', $extend({
                data: this, link: 'cancel', method: this.get('method') || 'post', url: this.getAttributeNode('action').nodeValue
            }, options));
        },
    

    The difference now is that instead of using this.get('action') you should use:

    this.getAttributeNode('action').nodeValue
    

    I dont know if its better to use this fix on the getProperty function or directly on the send property.

    This works crossbrowser. Please set as open!! (or another better state)

  • Christoph Pojer

    Christoph Pojer June 20th, 2009 @ 09:16 AM

    That is very interesting. We are going to consider it for inclusion in MooTools 2.0

  • Sebastian Markbåge

    Sebastian Markbåge June 21st, 2009 @ 07:14 PM

    • State changed from “invalid” to “open”
  • grazius

    grazius June 22nd, 2009 @ 09:04 PM

    Thanks that work fine now under IE.

  • Fábio M. Costa

    Fábio M. Costa April 5th, 2010 @ 02:09 AM

    • Milestone changed from 2.0 to 1.3.0 rc2

    should be fixed for 1.3

  • Fábio M. Costa

    Fábio M. Costa April 5th, 2010 @ 02:12 AM

    • State changed from “open” to “duplicate”

    duplicate of #747

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by

Pages