jquery-form/form

Enhancements needed to to be fully compatible with jQuery 3

kevindb opened this issue · 8 comments

jQuery 3 is removing a lot of features that have been depreciated for a long time. Some of these are still in use by jQuery Form.
https://jquery.com/upgrade-guide/3.0/

I have very little experience working with jQuery Deferred or Promises, so pull requests and assistance in updating jQuery Form is greatly appreciated.

Known issues

  1. #541 success and error Deferred methods
    https://jquery.com/upgrade-guide/3.0/#breaking-change-special-case-deferred-methods-removed-from-jquery-ajax
  2. #353 .selector property
    https://jquery.com/upgrade-guide/3.0/#breaking-change-deprecated-context-and-selector-properties-removed

Other related issues:
#527 feature for Deferred
#401 Submit only if a promise is resolved

Hi Kevin!

Thanks for this great plugin!

Do you have any progress on updating it for jQuery 3?

I have an issue using it, the selector is not working good :
$('form#myFormID').ajaxForm({ will trigger submit of any form in the page even forms with another ID.

Thanks

Hi again,

I am not a pro on github so I create a fork and modified the code to work with jquery 3 :
https://github.com/arirangz/form/blob/master/src/jquery.form.js

I replaced this.selector (which is now obsolete) by options.selector. So we need to provide the selector as an option :
$('form#myID').ajaxForm({
selector: 'form#myID',
target: '#myTarget',
delegation: true,
type: 'post',
....

I don't know if it's the best way but it works for me

Cheers

Hi, any update on this? We are also upgrading our website to jQuery 3.3.1 and seeing issues with jQuery form plugin. Please let us know.

Another warning from JQueryMigrate jQuery.isFunction() is deprecated and jQuery.trim is deprecated; use String.prototype.trim.

$.trim(action) can be replaced with action.trim().

isFunction is used in 3 places. According to the jQuery documentation, this can be replaced with (typeof x === "function")

@kevindb hi, guys. The library is used in Wordpress and it is one of the last ones with deprecated jQuery code, can you please replace the left instances of $.isFunction and make and update?

Hi @kevindb ,
The context property is removed in JQuery 3.0.

Do you have any plan to update the plugin to be compatible with JQuery 3.5?

Thanks

It seems like @xaabi6 sneaked in last autumn and provided a pull request, that fixes all the deprecation nagging.

@kevindb any chance, that you're having a look? The code changes seem reasonable and would be a big step forward.

Any update to this yet?