Hi thanks for the module.
When I submit the form at admin/config/system/asaf the submission is done via ajax.
I have put my form IDs in and presume they are working.
When I submit the node form I have set to use ajax a confirmation will appear at the top of the page with out a page refresh, but about a second later the form redirects to the node page. So if I submit or edit a node it looks as though it is submitting it via ajax, but still refreshes anyway. How can I stop the refresh/redirect?
Thanks for any help
Comments
Comment #1
taldy commentedHello,
First of all I want to say that our first and main goal during developing asaf was not to break anything. So if after node saving without asaf browser change the page and show the message, asaf should to do the same.
According your request...
1. Unfortunately currently you can't stop redirect/refresh from UI. If you really want to disable redirect/refresh you should implement HOOK_asaf_form_ajax_commands_alter or HOOK_asaf_form_FORM_ID_ajax_commands_alter in your custom module and remove entry which has command property equal 'asafRefresh'/'asafRedirect' . If you need more information about this, please let me know.
2. But you raised interesting questions about messages showed before redirect. It looks a little bit senseless showing messages right before redirect/refresh. I think I should support showing messages after redirect/refresh in case like node saving.
Regards,
Comment #2
pjmuszynski commentedHi,
How can I use these callbacks? I mean what parameters it takes and what should return?
I can't see any usage of this in example module... :(
Thanks in advance.
Comment #3
taldy commentedHi,
You can use one of the following hooks:
or
In both variants you'll get $commands variable by reference, and you can do whatever you want with it.
Comment #4
pjmuszynski commentedthank you, it's very useful info :)
Comment #5
klucid commentedHello,
First of all, thanks for your work on this module. I'm sorry, but I am very new to AJAX and hooks. I just need some help getting the form to submit without a page refresh/redirect.
Is it possible to add this function to my theme's template file instead of a custom module?
If my form ID is "link_node_form" should my hook be something like below?
What is an example of what I should do with the $commands variable to stop the page refresh/redirect?
Thank you so much for your time.
Comment #6
apmsooner commentedSee comment #1 for solution here: https://drupal.org/node/2277137