Solved

Jquery.form plugin submit onchange - problem

Posted on 2013-06-10
4
475 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 10

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 10

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jQuery Sticky Menu 24 40
links not working 2 25
converting document.write() to innerHTML 7 45
Jquery driving me nuts... 14 27
Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
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…
The viewer will learn how to dynamically set the form action using jQuery.
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…

740 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