0

I use Asaf (ajax submit for any form) module to Ajaxify form submissions in my website. This module works well but in comment form submission, it submits the comment then redirects the page to system/ajax#comment-cid which is a blank white page.

How can I solve this or is there any way out to Ajaxify comment form submission?

1

You need to look in to issues of that module I found there one important information which help on this issue. https://www.drupal.org/node/2277137

1

From This page I found the answer

In the template.php add the following code, replace epic_ajax with your theme name

// Disable the ajax redirect.
function epic_ajax_asaf_form_ajax_commands_alter(&$commands, $form, &$form_state, $form_id) {
    foreach($commands as $key => $command) {
        if ($form['#node']->nid) {
            if ($command['command'] == 'asafRedirect' || 'asafRefresh') {
                unset($commands[$key]);
                break;
            }
        }
    }
}
// These functions allow for subsequent saves without validation errors.
function epic_ajax_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'plan_node_form') {
        // Ensure our own validation is called first to overcome the node changed error node.module: 971
        array_unshift($form['#validate'], "epic_ajax_node_edit_validate");
    }
}
function  epic_ajax_node_edit_validate($form,&$form_state){
    // Update changed value to avoid node changed error node.module: 971
    $form_state['values']['changed'] =  $form_state['node']->changed;
}

you need to add this javascript code as well

(function ($, Drupal) {
      Drupal.behaviors.epicAjax = {
        attach: function(context, settings) {
    $('input, select').change(function() {
    $('#edit-actions .form-submit').first().trigger('mousedown');
    });
        }
      };
})(jQuery, Drupal);

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.