| Page 1 of 1 | [ 6 posts ] |
|
Hello, I am trying to submit a form that has a file input element. Without setting the property 'upload' the form submits successfully. When 'upload' is set to boolean 'true' the form again submits successfully but there is a different behavior between Chrome and Firefox and neither of them is the result I am striving to accomplish. Here is part of the code:
Code: console.log('attach submit handler'); formNode.on('submit', function (event) { event.preventDefault(); event.stopPropagation(); console.log('submit handler called'); sendRequest(); }); sendRequest = (function initRequest(node, formNode) { var url = formNode.getAttribute('action'); var method = formNode.getAttribute('method') || 'post'; var request = A.io.request(url, { method: method, dataType: 'text/html', autoLoad: false, form: { id: formNode, upload: true }, on: { start: function (e) { console.log('request start callback called'); }, complete: function (e) { console.log('request complete callback called'); var responseData = this.get('responseData'); console.log('responseData', responseData); var responseText = this.get('responseText'); console.log('responseText', responseText); } } }); var result = function () { console.log('sending request'); request.start(); }; return result; })(dialogBodyNode, formNode); In Chrome the response of the submit replaces the document content just as a regular non-ajax submit does. In Chrome console the 'complete' callback log message is missing : Code: attach submit handler submit handler called sending request request start callback called In Firefox the response of the AJAX submit is visible in FireBug Net panel but I haven't found a way to get the result from the javascript response object. FireBug console logs: Code: attach submit handler submit handler called sending request request start callback called request complete callback called responseData null responseText undefined The file input element is not required to be set by the user so I am submitting this form without choosing a file and still I have a hard time when 'upload' property is set. I have been searching for a solution and found several issues and forum threads related to submitting a form with a file input element to upload. I am using AUI framework that wraps YUI version 3.4.0. Thank you in advance! |
MarcYUI Contributor
|
I'd like to throw this problem in the hat also: viewtopic.php?f=92&t=9560 I am also experiencing problems with form submissions when upload is set to true
|
MarcYUI Contributor
|
BTW Here is the ticket I created at the time: http://yuilibrary.com/projects/yui3/ticket/2531860
I hope that this issue gets some love from the dev team. It's seems pretty major to me and I can't find a workaround. Cheers, Marc |
|
It looks that YUI3 is really not stable, it's the first function I need to use, io-base, maybe it's a bug, I can not submit the form with 'file' upload via ajax.
It's a break. |
MarcYUI Contributor
|
I think YUI 3 is stable, I use it for a large site implementation, although this particular functionality does desperately need some love
|
|
are there any solutions to submit form with file upload via Ajax? Thanks.
|
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group