Hi,
I believe I found a bug and implemented a fix for the following ...
If we use web2py_ajax_page js function to load forms in the same page with ajax (as in my case, using jquery ui dialog), and if the xhr calls for a redirect, then web2py incorrectly traps the new forms (via web2py_trap_form js function) with the original url action, instead of using the new redirected url action.
I solved this by adding the following to the model (so it's applied to all web requests):
response.headers['web2py-url'] = request.url
And by adding the following to web2py_ajax.html in web2py_ajax_page js function inside the 'complete' callback (as the first line):
action = xhr.getResponseHeader('web2py-url') || action
A better solution, instead of using a custom 'web2py-url' header, could be to detect the current xhr url location (original action or new action if redirected) inside the 'complete' callback, but I don't know where to extract such value from the xhr object.
I believe this does not break anything, but I haven't tested it in detail.
Regards,
Carlos