Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I successfully used this module to submit a "webform" form with a minimum of custom coding.. GREAT!
It submits ok, but nothing happens after the submit.. I see the "ajax" spinner next to it, so it must be possible to make it aware when the submit is done..
Any idea which callback I should use?
All I want to do is close the form, or at least show a message that it has been submitted.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#15 | 1396272-15_handle_submitted_forms.patch | 1.61 KB | Xen |
#11 | 1396272-11_handle_submitted_forms.patch | 1.59 KB | wojtha |
#10 | 1396272-10_handle_submitted_forms.patch | 1.6 KB | Xen |
#8 | 1396272-8_handle_submitted_forms.patch | 1.84 KB | wojtha |
#5 | 1396272.patch | 1.08 KB | douggreen |
Comments
Comment #1
wojtha CreditAttribution: wojtha commentedIts not possible at the moment, so this is a feature request.
Comment #2
wojtha CreditAttribution: wojtha commentedI've extended the CTools Automodals so now they knows how to handle submitted forms. You can try my patch here: #1420534-1: Consider a new hook - hook_ctools_automodal_paths() rather than using hook_menu()
Or just replace ctools_automodal_get_form() with this code:
Comment #3
douggreen CreditAttribution: douggreen commentedHere's the patch to just fix the bug.
Comment #4
wojtha CreditAttribution: wojtha commentedThis doesn't seem like a general fix.
Forms are usualy redirected using form_state[redirect] - this should be handled too imho.
Comment #5
douggreen CreditAttribution: douggreen commentedYou're right on both accounts, sorry, I was copying code from another module.
Comment #6
douggreen CreditAttribution: douggreen commentedComment #7
wojtha CreditAttribution: wojtha commented$form_state['destination'] should be $form_state['redirect']. And notice that $form_state['redirect'] can be both array or string.
Comment #8
wojtha CreditAttribution: wojtha commentedComment #9
wojtha CreditAttribution: wojtha commentedBetter title
Comment #10
Xen CreditAttribution: Xen commentedIf $form_state['redirect'] is an array, it is used as parameters to drupal_goto, which means that the second argument is options.
Added support for rebuilding forms, and cleaned up a bit.
Comment #11
wojtha CreditAttribution: wojtha commentedNice cleanup @Xen!
However, doesn't seem right to me.
In the drupal_redirect_form documentation is the following code:
So it should be:
list($path, $options) = $form_state['redirect'];
(However in this case we still silently suppose that non-mandatory $options array is present.)
Comment #12
wojtha CreditAttribution: wojtha commentedComment #13
Xen CreditAttribution: Xen commentedYou're right, that was a thinko.
Well, if options isn't set, $options should just be empty... Though the manual doesn't say.
Comment #14
Xen CreditAttribution: Xen commentedOk, make that:
Then options is always set, and an array (as expected by ctools_ajax_command_redirect) per default.
Comment #15
Xen CreditAttribution: Xen at Reload commentedAnd patch...
Comment #16
rv0 CreditAttribution: rv0 commentedTrying to get this to work with forward.module (http://drupal.org/project/forward), but no luck so far.
Submit works, but I get a huge js error (200) afterwards.
When I add an extra submit function to the form, that has nothing but
exit();
in it, I don't get the error (but nothing closes)Any ideas?
Comment #17
bdawg8569 CreditAttribution: bdawg8569 commentedI am having an issue with submitting a form as well. I want the form to redirect, however, i don't want it to redirect to the same place each time. Inside of the form submit, i am making a call to a function that takes the form and determines if the person should go to one of two places. Is it possible to do this type of thing? If i try to change the form_state['redirect'] i get ajax errors.
Comment #18
wojtha CreditAttribution: wojtha commented@rv0 with the patch in #15 it should work. May be you can try my experimental build of this module, see #1420534-4: Consider a new hook - hook_ctools_automodal_paths() rather than using hook_menu()
@bdawg8569 are you getting Ajax errors with the patch in #15 or without?
Comment #19
rv0 CreditAttribution: rv0 commented@wojtha
I tried the experimental build, but it doesn't work on PHP <5.3 https://github.com/wojtha/ctools_automodal/issues/1
Will also retry #15 on a fresh install.
Comment #20
Xen CreditAttribution: Xen commented@rv0:
Does the menu item that you're modalling have 'page callback' => 'drupal_get_form'? Automodal doesn't work well with page callbacks that call drupal_get_form themselves.
Comment #21
wojtha CreditAttribution: wojtha commented@Xen good point
@rv0 if it is that case you can take some inspiration from #1450372: How to: How to handle two forms in one modal (unified login page). I've described there how to handle two forms in one modal window. For live example you can go to http://ecommera.com and click on "Register".
Comment #22
rv0 CreditAttribution: rv0 commentedthe menu item looks like this
The forward_page function looks like it hasn't changed since D6 as it has some legacy modalframe code in it.
it applies some logic and then returns a result of drupal_get_form
http://drupalcode.org/project/forward.git/blob_plain/HEAD:/forward.module
Comment #23
Xen CreditAttribution: Xen commentedThen it's really a separate issue. The code this issue deals with determines forms from the menu callback.
Whether there really is a general way of dealing with forms in page callbacks is the question.
Comment #24
Agence Web CoherActio CreditAttribution: Agence Web CoherActio commentedHi,
I've tried patch #15 with a webform having confirmation message set a "No redirect (reload current page)".
The form submits correctly and I can see the throbber. However the confirmation message is not displayed in the modal window after the submission. It is displayed into the background window after a full page reload
Any idea?
Thanks
Laurent
Comment #25
wojtha CreditAttribution: wojtha commented@Laurent, you may try my fork of this module https://github.com/wojtha/ctools_automodal, there you can handle confirmation messages (details here: #1420534: Consider a new hook - hook_ctools_automodal_paths() rather than using hook_menu())