0

I have an AJAX form with a callback that fires some JavaScript when the form is submitted.

I need to know what has been repainted. Can I get the class / ID of the parts of the form that have been changed by submitting the form?

AJAX callback:

function _my-module_form_process_callback_js($form, &$form_state) {
  $commands = array();

  $commands[] = array (
    'command' => 'customSomething',
  );

JavaScript:

  Drupal.ajax.prototype.commands.customSomething = function(ajax, response, status) {

    console.log(ajax);

  };

By logging ajax I can see the form ID and class. However I don't belive that the entire form is being repainted. Most of the form is unchanged, its only one fieldset that changes.

1 Answer 1

0

I don't know if its the best solution but this works:

  Drupal.ajax.prototype.commands.customSomething = function(form) {

    var formId = '#' + form.form.context.id;

  };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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