I simply want to remove the redirect on ajax saves. This question is recurring i know.... and i've researched and tested the advised approach but I must be doing something wrong.
I'm putting in my theme template.php:
function MYTHEMENAME_asaf_form_ajax_commands_alter(&$commands, $form, &$form_state, $form_id) {
$commands[] = ajax_command_remove('asafRedirect');
return array(
'command' => 'remove',
'selector' => $commands,
);
}
I'm clearly not understanding how to remove the command... can you help?
Comments
Comment #1
taldy commentedHello apmsooner,
You should try something like this:
I can't run and test it now because I'm writing from my phone, but this code should work :)
Comment #2
apmsooner commentedThanks so much for the reply. I modified my code and cleared the cache however.... still redirecting. I'd sure appreciate a followup with code that will work when you get a chance.Would help if i put the code in the right template! Your code works great. Thank you so much!
Comment #3
apmsooner commentedComment #4
W.M. commentedIs the information here (at comment #1) still valid?
I am trying to use the hook under omega and tej themes but failing.
I basically need to refresh a view inside one page at my site after submitting a node add form using ASAF. The add node form and the view are both on same page. I want to update the view without the need to reload the page after Ajax form submit. I think ajax commands is the way to go.
Any help would be highly appreciated.
Comment #5
apmsooner commentedI provided complete example here: https://www.drupal.org/node/2301041
Try with that code and see if it helps
Comment #6
candelas commentedThanks @taldy your example still works :)