Problem/Motivation

I want a form to be ajax submitted. As per the docs, I added class use-ajax-submit to the submit button of the form. The ajax submit is working if the page has the admin toolbar, but for users who cannot see the admin toolbar, for them it throws error:

drupal_ajax: ajax.$form.ajaxSubmit is not a function

I had to add core/jquery.form and core/drupal.ajax libraries to the form, to make it work.

Proposed resolution

Libraries core/jquery.form and core/drupal.ajax should be added by itself if use-ajax-submit class is added to the submit button.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

subhojit777 created an issue. See original summary.

subhojit777’s picture

Issue summary: View changes
subhojit777’s picture

subhojit777’s picture

Issue summary: View changes
subhojit777’s picture

Version: 8.3.5 » 8.4.x-dev
Related issues: +#2910740: Ajaxify the Remove from cart button
nod_’s picture

Version: 8.4.x-dev » 8.5.x-dev
Component: ajax system » documentation
Issue tags: +JavaScript

we don't parse information in classes to add libraries. The docs needs to be updated to say those dependencies are needed when using this class.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.