views:

146

answers:

2

Hello Guys, I'm using this plugin http://www.fyneworks.com/jquery/multiple-file-upload/ to create a mail attach system, but it is failing to execute on IE7.

Here's my code:

$(".attachFile").live("click",function(){
    var id ="#"+$(this).parent().parent().attr("id");
    $(id + ' #attach').MultiFile({
        onFileAppend: function(element, value, master_element){ 
        $("#"+id + ' .attach-list').append('<li>onFileAppend - '+value+'</li>') 
        var options = { 
            url:       '/setAttach',         // override for form's 'action' attribute 
            type:      'POST'        // 'get' or 'post', override for form's 'method' attribute 
        }; 

        // bind to the form's submit event 
        $("#"+id + ' #uploadForm').submit(function() {

           $(this).ajaxSubmit(options); 

           return false; 
        });
    }, 
    afterFileAppend: function(element, value, master_element){ 
     $("#"+id + ' #uploadForm').submit();
    }
});
});

This event is fired when user clicks hover a link to attach files. Any clues for what I'm doing wrong?

Thanks

A: 

cmedeiros, I'm the developer of the plugin in question. What do you expect to happen? And what do you see instead?

I know you said it fails to execute, but at which point?

Diego
Hi Diego, It didn't bind the plugin to my element, I load MultFile at the time I create my input in the DOM, but it didn't bind it to my element. It works fine on IE8, but not in IE7. Also, I tested your examples at IE7 and everything worked fine. I think it's something on my application, that it's not allowing MultiFile to be attached through jquery .live() method. Thank you for your attention.
cmedeiros
In your code you say...$(id + ' #attach').MultiFile({Can you verify that $(id + ' #attach') exists at that point?
Diego
A: 

I found a solution, first create the element in the DOM, then bind MultiFile to it, and in the end append it to the screen:

var e = $("<div id=\""+id+"\" class=\"inner-center compose hidden\">"+$("#form").html()+"</div>");

$('#attach',e).MultiFile({ ... ACTIONS ... });

$(".middle-center").append(e);

Worked very well.

cmedeiros