Solved

Jquery.form plugin submit onchange - problem

Posted on 2013-06-10
4
470 Views
Last Modified: 2013-06-11
Hello experts.
I want to use jquery.form plugin.
The problem i have is that i need to fire the ajax - submit on file select but i can't.
Here is my code
$(document).ready(function () {
 $("#instruc").on("change", ".filefield", function (e) {
     e.preventDefault();
     var myform = $(this).parent('form');
     $(myform).ajaxForm({
        dataType: 'json',
        url: 'myactionpage.cfc',
        beforeSubmit: validate,
        beforeSend: function () {},
        uploadProgress: function (event, position, total, percentComplete) {},
        complete: function (response) {}
    }, "json");
  }
 )
});

Open in new window

0
Comment
Question by:Panos
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Ishaan Rawat earned 500 total points
ID: 39236683
Try these.. one of these should work....
sorry for two answers but I am confused in a little thing..
Comment if any of the two works,,,,,

$(document).ready(function () {
 $("#instruc").on("change", ".filefield", function (e) {
     e.preventDefault();
     var myform = $(this).parent('form');
     myform.ajaxForm({
        dataType: 'json',
        url: 'myactionpage.cfc',
        beforeSubmit: validate,
        beforeSend: function () {},
        uploadProgress: function (event, position, total, percentComplete) {},
        complete: function (response) {}
    }, "json");
  });
});

Open in new window


OR

$(document).ready(function () {
 $("#instruc").on("change", ".filefield", function (e) {
     e.preventDefault();
     var myform = this.parent('form');
     myform.ajaxForm({
        dataType: 'json',
        url: 'myactionpage.cfc',
        beforeSubmit: validate,
        beforeSend: function () {},
        uploadProgress: function (event, position, total, percentComplete) {},
        complete: function (response) {}
    }, "json");
  });
});

Open in new window

0
 
LVL 2

Author Comment

by:Panos
ID: 39236930
Hi.
None of the two is working. I changed
$(myform).ajaxForm({
to
$(myform).ajaxSubmit({

Now it is working. I don't know what the differences between ajaxForm and ajaxSubmit are
0
 
LVL 9

Expert Comment

by:Ishaan Rawat
ID: 39237032
oo man its a big difference...

you should have specified...
0
 
LVL 2

Author Comment

by:Panos
ID: 39237266
I have the same code without the on change event ( it is working submiting the form with a button). It is working with ajaxForm.  In this case it is not.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json value get in input box 6 44
How can I see the value of the "object" 10 27
jQuery aJax Disable Async 24 41
Jquery autocomplete 10 21
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now