1

I receive the following message when I attempt to submit a form with use-ajax-submit class attached to the submit button:

An error occurred while attempting to process /my_form?_wrapper_format=drupal_ajax: ajax.$form.ajaxSubmit is not a function

Similar to this question, but for Drupal 8.

2

The following dependencies need to be added to the library attached to the form in order to use use-ajax-submit.

my_module.libraries.yml

my_module.my_library:
  dependencies:
    - core/drupal.ajax
    - core/jquery.form

The library needs to be attached to the form:

$form['#attached']['library'][] = 'my_module/my_module.my_library';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.