sadik7266 / jquery-multifile-plugin

Automatically exported from code.google.com/p/jquery-multifile-plugin
0 stars 0 forks source link

Adding formData on BeforeSubmit event #143

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Use Ajax Submit sample and point to asp.net Handler file.
2.Use beforeSubmit event to add one more form data like 
formData.push({name:"uploadedBy",value:"suresh"});
3.In server side asp.net handler.Try to get the form values using 
context.Request.Form which is empty.

What is the expected output? What do you see instead?
Posted Form data must be available in server.
But it is not there.

What version of the plugin/jQuery are you using?
PLUGIN VERSION:Plugin v1.47
JQUERY VERSION:jquery-1.7.1.min.js

On what browser(s) or operating system?
BROWSER(S):IE 9 & FIREFOX 10.0.2

Please provide a link to where the problem can be observed:
URL:

Feel free to provide any additional information below.
I want to post data with the existing form data.

Original issue reported on code.google.com by MailToSu...@gmail.com on 16 Mar 2012 at 12:37

GoogleCodeExporter commented 8 years ago
This plugin doesn't actually submit the form at any point. And also doesn't 
create or handle any events relating to form submission.

but it does override known plugins/functions that do.

Are you using the form plugin to submit via ajax?
If so you can pass the extra parameters as you normally would to the form 
plugin.

If not, how are you submitting the form? A conventional click on a submit 
button? Some other function?

Original comment by diego.a...@gmail.com on 16 Mar 2012 at 12:53

GoogleCodeExporter commented 8 years ago
Yes ,I used AjaxSubmit,also i am passing json data in data parameter.But i am 
not able to receive that json data.

Original comment by MailToSu...@gmail.com on 16 Mar 2012 at 2:01

GoogleCodeExporter commented 8 years ago
Is there somewhere I can see your code in action? Or can you post the relevant 
bits here?

Original comment by diego.a...@gmail.com on 16 Mar 2012 at 2:04

GoogleCodeExporter commented 8 years ago
Here is the code i am trying

 $('#ajax-button').click(function () {
            $('#frmUpload').ajaxSubmit({
                data: {"x":-10753683.829803184,"y":4631949.57420643,"spatialReference":{"wkid":102100}},
                success: function (r) {
                    $('#ajax-results').html(r);
                    $('input:file').MultiFile('reset');
                }
            });
        });

Original comment by MailToSu...@gmail.com on 16 Mar 2012 at 2:24

GoogleCodeExporter commented 8 years ago
I guess the problem is this...
"spatialReference":{"wkid":102100}

You're passing an object where the form plugin expects a "key":"value" pair. 
Removing this worked in my tests, can you give it a go?

Original comment by diego.a...@gmail.com on 16 Mar 2012 at 3:01

GoogleCodeExporter commented 8 years ago
Also note that, from my experience in ASP, it's no possible to post data along 
with binary data. So depending on your server-side implementation, it may be 
easier to achieve the same result by simply adding the additional data to the 
action of the form and retrieving them on server from the query string.
ie.:
<form action="upload.something?extra=1&data=2&goes=3&here=4">
...
</form>

Original comment by diego.a...@gmail.com on 16 Mar 2012 at 3:06

GoogleCodeExporter commented 8 years ago
Yes,i think so.Thanks for your solution.

Original comment by MailToSu...@gmail.com on 17 Mar 2012 at 5:05

GoogleCodeExporter commented 8 years ago

Original comment by diego.a...@gmail.com on 17 Mar 2012 at 7:34