New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jquery.form.js, Line 352 Character 5 #139
Comments
I'm having this exact same issue. It happens only in IE (at least IE8, I haven't tested other versions yet) ... and is on the line: Appears that IE isn't allowing access to submit the form for some reason? Any idea why this would be? |
finaly someone with the same issue as me! |
Some additional research on this so far, seems to indicate that IE doesn't like having a file-upload form be autosubmitted by any event on the file-upload form itself. In my case, I'm watching for .change() on the input field, and trying to submit. But IE won't allow that. I've been researching some workarounds, and the one I've found so far appears to involve having the .change() event, actually create a new file upload form, cloning the input field into it, and then submitting that. Ugh. There has to be a way to get this to work with jquery.form though |
there should be a way we just need to find it :/ |
I've actually switched to using this: http://valums.com/ajax-upload/ - Which takes care of doing the 'workaround' for IE. Seems to work in all browsers. Not as generic as the jquery.form plugin. But works for the 'one need' I have |
Do you happen to have an input with an id of "submit"? |
no this is my form
|
Ah, I see what you're saying now. Would it work if sendPhoto were in a setTimeout? |
function sendPhoto(Form_Object){
} |
|
I will try tommorrow, i would be so happy to fix my issue |
i tried it and it still doesn't work with internet explorer. SCRIPT5: Access Denied. jquery.form.js, Ligne 352 Caracter 5 |
Agreed w/ LinkUpdated ... There is no submit ID ... When I researched this in more depth. It appears that IE simply blocks the ability for any form w/ a file input in it, from being submitted based upon an event that happened on the form. IE, you can't just .submit() upon a .change() ... And yes, it seems fancy enough if it's tracking to know the context of a setTimeout() and still not work. I tried that too :) The only workaround appears to be the solution used in that ajax-upload (the older version is simpler/easier to see the solution in) ... Wherein they don't actually use the main form. But they create a new form. Basically on .change(), they create a new form on the page, clone the file-input into it (so it still has the filename element), and then submit that new form. This means that the form that is being submitted, isn't the same form as the one the event happened on. And it works. |
I had the exact same problem in ie and this was the solution: It's weird, but using click() to open the file input worked, but submitting it got the access denied error. |
thanks, actualy thats the exact thing i did, but i forgot this thread so i didnt reply. it seems that ie dont like js to invoke file input with click. |
of course now I'm having the problem where the form submits twice but only on IE :( |
never had this :(. thats suck, freakin explorer. |
Anyone managed to solve this? I have the same issue when using .ajaxSubmit() on the form. |
like we said, its very simple once you found it, explorer wont let you upload file if you invoke .click() on the |
Any other way to open the file browser without actually clicking the real browse button on the file field? I am having trouble styling it, so I was just hiding it and using javascript to trigger the click() event. |
Yes, use the solution that I provided above. Either by implementing your own based upon .change(), or just using the ajax-upload library that I found, and which works fine. |
This solution? "Basically on .change(), they create a new form on the page, clone the file-input into it (so it still has the filename element), and then submit that new form. This means that the form that is being submitted, isn't the same form as the one the event happened on. And it works." |
I ended up using ajax-upload like EliW suggested, worked great! |
Alright, so I'm attempting this same thing (submitting ajax file upload with jquery.form.js from a change event on the file input in IE) and it seems like the solution was to clone the file input in to another form and then submit that... however, I can't seem to find any way to clone that input while keeping the filename attribute intact... in IE. Everywhere I look online seems to say this is IE security and is impossible. How can this input be cloned without losing the filename and rendering this solution useless? |
Hello, i try the solution to clone the input file in a new form, then submit the new form. But the problem is the new input file cloned have no value (http://bugs.jquery.com/ticket/3639) |
hey I found solution .
} |
i have this problem, and spend a lot of time to resolve it ,but can't |
For those of you who tried the workarounds and still get the annoying "Access denied" JS error on form submit Please "reset" your IE settings and try again. Tested on IE 8 and 9. |
@skoant , i cant tell every visitor of my site "please reset your IE settings" !!!!!!!!!!!!!!!!! |
@zhilevan: Exactly, i bet the majority (if not all) of IE users surfing with default settings. |
this bug is old, and for implement my aid i do it with trickly method.tnx for you replay, but i reset it and not work for me.tnx. notice that we must consider all of visitor not major of them, maybe you want present your site in palce that the IE setting have some changes from default :(. tnx skoant for you replies. |
Was anybody able solve this issue? |
LOL a bug that lives 2 whole years because of IE... We devs should make a pact, do not give a fck about IE, let the IE users experience the shitty sites and webapps. MS will give IE users what they deserve ;) MS, you're either with us (devs) or against us, how's it gonna be !? |
@malsup: Thank's for a great plugin! I have some kind of solution based on this issue notes (at least in IE9, not checked in IE8 yet).
The solution is to not .click() on input in js but instead provide a way for user to actually click on input and then on input change event we can do .ajaxSubmit(). Here is a couple js functions I use to absolutely place input: // $target container must have relative or absolute position
var root = window,
$input = $('input[name="file"]'),
$target = $('#upload-button');
function ieFileInputPlacementFix($input, $target) {
var p, w, h;
if ($input.length && $target.length) {
p = $target.position();
w = $target.outerWidth();
h = $target.outerHeight();
$input.css({
display: 'block',
position: 'absolute',
top: p.top,
left: p.left,
width: w,
height: h,
padding: 0,
margin: 0,
'line-height': 'auto',
opacity: 0,
cursor: 'pointer'
});
}
}
// detect File API support in browser
function hasFileAPISupport() {
return !_.isUndefined(root.File && root.FileReader && root.FileList && root.Blob);
} Hope it helps. |
There are not solved. |
Here's a test file if anyone wants to dig into this further. Current observations: one of the forms won't show the file dialog on IE 8, the ones that don't immediately throw an Access Denied error seem to do double submits in IE 8 and IE 9 and probably don't work either (I'm seeing the same Access Denied errors when stepping through the jQuery Form code). I've spent a whole day on this, I'll just give up now and show the default file input field on IE 8 and IE 9. Some additional info that may help anyone digging into this: http://stackoverflow.com/a/13994638/247702 <!doctype html>
<title>Styling a file input element</title>
<style>
button[type=button], label
{
border: 1px solid #000000;
}
.hidden
{
display: none;
}
.off-screen
{
right: 100%;
position: absolute;
}
</style>
<h1>Form with hidden file input and styled button</h1>
<form action="http://posttestserver.com/post.php?dump&html" method="post" enctype="multipart/form-data">
<input name="file" type="file" class="hidden">
<button type="button">browse</button>
<button type="submit">submit</button>
</form>
<h1>Form with hidden file input and styled label</h1>
<form action="http://posttestserver.com/post.php?dump&html" method="post" enctype="multipart/form-data">
<input name="file" type="file" id="file2" class="hidden">
<label for="file2">browse</label>
<button type="submit">submit</button>
</form>
<h1>Form with off-screen file input and styled button</h1>
<form action="http://posttestserver.com/post.php?dump&html" method="post" enctype="multipart/form-data">
<input name="file" type="file" class="off-screen">
<button type="button">browse</button>
<button type="submit">submit</button>
</form>
<h1>Form with off-screen file input and styled label</h1>
<form action="http://posttestserver.com/post.php?dump&html" method="post" enctype="multipart/form-data">
<input name="file" type="file" id="file4" class="off-screen">
<label for="file4">browse</label>
<button type="submit">submit</button>
</form>
<h1>Output</h1>
<div id="output"></div>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script>
$("button[type=button]").on("click", function ()
{
$(this).prev().click();
});
$("form").on("submit", function ()
{
$("#output").html("");
$(this).ajaxSubmit(
{
success: function (data)
{
$("#output").html(data);
}
});
return false;
});
</script> |
I got this error:
SCRIPT5: Access Denied.
jquery.form.js, Line 352 Character 5
:/, i searched so much on this issue and didnt find any solutions.
$('#crop_form').bind('submit', function(e){
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#output',
success: function() {
hideLoading();
}
});
});
The text was updated successfully, but these errors were encountered: