jQuery Form Plugin - file upload - wierd form reseting behavior

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

jQuery Form Plugin - file upload - wierd form reseting behavior

CasperF
Hi,

I am using the form plugin to upload images. It works in itself, but has the wierd behavior of reseting the form after submiting the form. The upload continues and everything is fine - but i.e. the file name gets removed from the file-input field.

Additionally wierd is that on retruning false on "beforeSubmit:" checks (i.e. if agreeToU checkbox has been selected) the form resets as well. so that the user would have to select the file again.

Why? What am I doing wrong?

$('#uploadImage form').livequery('submit', function() {
   $(this).ajaxSubmit({
   clearForm: false, resetForm: false,
   beforeSubmit: function() {
      if ( !$('#agreeToU').is(':checked') )
      { alert ( 'You must agrree to our terms.' ); return false; }
   },
   success: function (data) { $('#uploadImage').replaceWith(data); }
   });
return false;
});

Thanks for any replys
Casper
Reply | Threaded
Open this post in threaded view
|

Re: jQuery Form Plugin - file upload - wierd form reseting behavior

Mauro76

Have you tried using ajaxForm instead of ajaxSubmit ?

Mauro

2009/1/18 CasperF <[hidden email]>:

>
>
> Hi,
>
> I am using the form plugin to upload images. It works in itself, but has the
> wierd behavior of reseting the form after submiting the form. The upload
> continues and everything is fine - but i.e. the file name gets removed from
> the file-input field.
>
> Additionally wierd is that on retruning false on "beforeSubmit:" checks
> (i.e. if agreeToU checkbox has been selected) the form resets as well. so
> that the user would have to select the file again.
>
> Why? What am I doing wrong?
>
> $('#uploadImage form').livequery('submit', function() {
>   $(this).ajaxSubmit({
>   clearForm: false, resetForm: false,
>   beforeSubmit: function() {
>      if ( !$('#agreeToU').is(':checked') )
>      { alert ( 'You must agrree to our terms.' ); return false; }
>   },
>   success: function (data) { $('#uploadImage').replaceWith(data); }
>   });
> return false;
> });
>
> Thanks for any replys
> Casper
> --
> View this message in context: http://www.nabble.com/jQuery-Form-Plugin---file-upload---wierd-form-reseting-behavior-tp21525391p21525391.html
> Sent from the jQuery Plugins mailing list archive at Nabble.com.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: jQuery Form Plugin - file upload - wierd form reseting behavior

CasperF
Had no effect. Interesstingly engough the form does not seem to reset it seems to actually reload. If I add other fields such as text-fields they get "emptied" as well. Btw. the error happens in both IE and FF.

Casper


Mauro76 wrote
Have you tried using ajaxForm instead of ajaxSubmit ?

Mauro

2009/1/18 CasperF <casper.feldmann@gmail.com>:
>
>
> Hi,
>
> I am using the form plugin to upload images. It works in itself, but has the
> wierd behavior of reseting the form after submiting the form. The upload
> continues and everything is fine - but i.e. the file name gets removed from
> the file-input field.
>
> Additionally wierd is that on retruning false on "beforeSubmit:" checks
> (i.e. if agreeToU checkbox has been selected) the form resets as well. so
> that the user would have to select the file again.
>
> Why? What am I doing wrong?
>
> $('#uploadImage form').livequery('submit', function() {
>   $(this).ajaxSubmit({
>   clearForm: false, resetForm: false,
>   beforeSubmit: function() {
>      if ( !$('#agreeToU').is(':checked') )
>      { alert ( 'You must agrree to our terms.' ); return false; }
>   },
>   success: function (data) { $('#uploadImage').replaceWith(data); }
>   });
> return false;
> });
>
> Thanks for any replys
> Casper
> --
> View this message in context: http://www.nabble.com/jQuery-Form-Plugin---file-upload---wierd-form-reseting-behavior-tp21525391p21525391.html
> Sent from the jQuery Plugins mailing list archive at Nabble.com.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to jquery-plugins@googlegroups.com
To unsubscribe from this group, send email to jquery-plugins+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---
Reply | Threaded
Open this post in threaded view
|

Re: jQuery Form Plugin - file upload - wierd form reseting behavior

CasperF
Update: did not change any of the code, but it now has stopped doing it (refreshing/reloading the form). Everything works now as it should - question is just why? Oh well.

CasperF wrote
Had no effect. Interesstingly engough the form does not seem to reset it seems to actually reload. If I add other fields such as text-fields they get "emptied" as well. Btw. the error happens in both IE and FF.

Casper


Mauro76 wrote
Have you tried using ajaxForm instead of ajaxSubmit ?

Mauro

2009/1/18 CasperF <casper.feldmann@gmail.com>:
>
>
> Hi,
>
> I am using the form plugin to upload images. It works in itself, but has the
> wierd behavior of reseting the form after submiting the form. The upload
> continues and everything is fine - but i.e. the file name gets removed from
> the file-input field.
>
> Additionally wierd is that on retruning false on "beforeSubmit:" checks
> (i.e. if agreeToU checkbox has been selected) the form resets as well. so
> that the user would have to select the file again.
>
> Why? What am I doing wrong?
>
> $('#uploadImage form').livequery('submit', function() {
>   $(this).ajaxSubmit({
>   clearForm: false, resetForm: false,
>   beforeSubmit: function() {
>      if ( !$('#agreeToU').is(':checked') )
>      { alert ( 'You must agrree to our terms.' ); return false; }
>   },
>   success: function (data) { $('#uploadImage').replaceWith(data); }
>   });
> return false;
> });
>
> Thanks for any replys
> Casper
> --
> View this message in context: http://www.nabble.com/jQuery-Form-Plugin---file-upload---wierd-form-reseting-behavior-tp21525391p21525391.html
> Sent from the jQuery Plugins mailing list archive at Nabble.com.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to jquery-plugins@googlegroups.com
To unsubscribe from this group, send email to jquery-plugins+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---
Reply | Threaded
Open this post in threaded view
|

Re: jQuery Form Plugin - file upload - wierd form reseting behavior

malsup



On Jan 19, 3:16 am, CasperF <[hidden email]> wrote:
> Update: did not change any of the code, but it now has stopped doing it
> (refreshing/reloading the form). Everything works now as it should -
> question is just why? Oh well.

I'd bet $10 you had a script error somewhere.  That is a classic
symptom - the form does a normal browser submit and the whole page
reloads.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---