views:

44

answers:

1

Console is returning blank for the action attr. I've moved the:

$('#file_upload').attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));

Around in and out of the .live('submit') and no luck. I also tried it without the +$('.agenda-modal').attr('data-defaultitemid') part and it still returns blank. Ive removed everything in my form to JUST:

$('#file_upload').live('submit',function(event){
        $(this).attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));
});

and still nothing. It submits to nowhere, and returns action=""

Lastly, it works in all other browsers, just not Firefox :( Does anyone have any ideas?

Here is the HTML just in case you want to see it:

<form id="file_upload" method="post" enctype="multipart/form-data" target="upload_target" action="">
    <input name="binary" id="file" size="27" type="file" /><br />
    <br><input type="submit" name="action" value="Upload" /><br />
    <iframe id="upload_target" name="upload_target" src="" style="display:none"</iframe>
</form>
+1  A: 

Based on this comment on the attr() documentation, it appears that action must be capitalized to work in Firefox:

$('#file_upload').live('submit',function(event){
    $(this).attr('ACTION','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));
});

I've got money that says that breaks it in IE...

Pat
nice find Pat! (why the hell wouldn't jQuery handle this natively?) anyways, ill try it out, let you know, and hopefully get you some points...
Oscar Godson
I know - pretty crazy eh? Hope it does the trick for you.
Pat
You fuckin' rock man. Thanks! It works, AND it FIXED IE :)
Oscar Godson
This information is incorrect in general. It is not necessary to capitalize the "action" attribute *unless* an `<input>` in the form has a "name" attribute of "action".
Pointy
Thanks for the info @Pointy. I remember screwing up my form submits in IE once when I named an input as follows: `<input name="name"/>`. Live and learn eh?
Pat