When attempting to log in via block attached in ajax mode destination goes to domain.com/menu_attach_block/ajax/user|login and white screen. Is there a way to fix this?

Comments

Cameron Tod’s picture

OK, I have managed to reproduce this. I am just jumping on a plane now, but will try to think through the cleanest way to fix this for all forms.

The root cause is that the form action refers to menu_attach_block/ajax - so we need to strip that.

<form action="/menu_attach_block/ajax/user%7Clogin?destination=menu_attach_block/ajax/user%7Clogin" method="post" id="user-login-form" accept-charset="UTF-8"><div><div class="form-item form-type-textfield form-item-name">
flamez-b’s picture

Thank you for your quick reply. It would be great if this module could be more flexible regarding pulling blocks in ajax mode as we know that html-code of pages would be much smarter without unnecessary amount of lines (especially generated by forms) that produce no actions (until users wishes them to).
Waiting for new updates!

Cameron Tod’s picture

OK, I have tried refactoring this to use the Drupal AJAX API instead of a jQuery-initiated AJAX response. Unfortunately, the form still does not redirect correctly after submit.

This is a tricky one, but I'll keep plugging away.

Cameron Tod’s picture

Title: Login block via ajax » Forms loaded via AJAX submit correctly but redirect to an AJAX response
flamez-b’s picture

It’s been a year since the last reply and no updates. Are there any plans for a new release with bug fixes?

Cameron Tod’s picture

Assigned: Unassigned » Cameron Tod

I took quite a long time over this back when I was working on it and it is tricky. I will bring in some more patches, do a new release, then try this again.

Cameron Tod’s picture

I've added a warning on the module page in the meantime: https://www.drupal.org/project/menu_attach_block#ajax-form-submit