When clicking an element I get a form which is generated by a view (using https://www.drupal.org/project/editablefields module). The problem is that the ajax functionality of the form is lost (no ajax-processed classes are present). This is the working js code to retrieve the view:

(function($,Drupal) {
  Drupal.behaviors.MODULE = {
    attach:function (context, settings) {   
      $('#test').click(function () {
        var args = (1, 2, 3);
          url: Drupal.settings.basePath + 'views/ajax',
          type: 'post',
          data: {
            view_name: 'test_view',
            view_display_id: 'block',
            view_args: args,
          dataType: 'json',
          success: function (response) {
            if (response[1] !== undefined) {    
              var viewHtml = response[1].data;
}(jQuery, Drupal));

So my question is how to get ajax working again on the form? Do I have to call ajax_pre_render_element and if so in which PHP function?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Nov 24, 2021 at 15:17


Your Answer

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

Browse other questions tagged or ask your own question.