Probably caused by changes in webform module, currently the confirmation screen is never shown after submit, it is stuck at the form.
Setting this to Major as it breaks the webform functionality.

The fix is just one line of code, patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rv0 created an issue. See original summary.

rv0’s picture

Patch does this:

-    if (!isset($form_state['storage'])) {
+    if ($form_state['webform_completed']) {

Tested with multi step forms and it works.
Test with Webform 4.
This MAY break Webform 3 (not sure when webform_completed was introduced)
In any case it is a bad idea to rely on the presence of form state storage because other modules might put things there too..

rv0’s picture

Status: Active » Needs review
Dimetry’s picture

thank you
patch works for me

ben.bunk’s picture

Status: Needs review » Reviewed & tested by the community

This patch worked for me agains the latest dev branch.

elstudio’s picture

+1 for RTBC.

Thanks for the patch!

andyg8’s picture

Hmmm... thanks for this patch, but it didn't seem to help me with webform 7.x-4.12 and Modal forms 7.x-1.2+16-dev. I am also having the same behaviour with the Modal forms 7.x-1.2 stable version.

When I click submit on a modal form, a new window - about:blank - opens with raw code. And on the original window, the from is stuck in 'loading'. Nevertheless, the form's data was submitted successfully.

I am not seeing any errors on the page in Console..

Below is the first few lines of that raw code on the about:blank page.

Thanks for any help you can give, folks!

"0":{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"yo","theme_token":"PypTCjoVSayMJo_wEOMOsNE7LldxDl8w_lDPHJJUEpk","jquery_version":"1.8"},"loginlogout":{"urls":{"\/user\/login":"\/user\/login?destination=modal_forms\/ajax\/webform\/258","\/user\/logout":"\/user\/logout?destination=modal_forms\/ajax\/webform\/258"}},"colorbox":{"transition":"elastic","speed":"350","opacity":"0.85","slideshow":true,"slideshowAuto":false,"slideshowSpeed":"3500","slideshowStart":"Start slideshow","slideshowStop":"Stop slideshow","current":"{current} of {total}","previous":"\u00ab Prev","next":"Next \u00bb","close":"Close","overlayClose":true,"maxWidth":"98%","maxHeight":"98%","initialWidth":"300","initialHeight":"250","fixed":true,"scrolling":true,"mobiledetect":true,"mobiledevicewidth":"480px"},"jcarousel":{"ajaxPath":"\/jcarousel\/ajax\/views"},"CToolsModal":{"loadingText":"Loading...","closeText":"Close Window","closeImage":"\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/[our-website.com]\/sites\/all\/modules\/ctools\/images\/icon-close-window.png\u0022 alt=\u0022Close window\u0022 title=\u0022Close window\u0022 \/\u003E","throbber":"\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/[our-website.com]\/sites\/all\/modules\/ctools\/images\/throbber.gif\u0022 alt=\u0022Loading\u0022 title=\u0022Loading...\u0022 \/\u003E"},"modal-popup-small":{"modalSize":{"type":"fixed","width":300,"height":410},"modalOptions":{"opacity":0.9,"background-color":"#CFC8C1"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/[our-website.com]\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022Loading...\u0022 title=\u0022Loading\u0022 \/\u003E","closeText":"Close"},"modal-popup-medium":{"modalSize":{"type":"scale","width":0.5,"height":0.8},"modalOptions":{"opacity":0.9,"background-color":"#CFC8C1"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/[our-website.com]\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022Loading...\u0022 title=\u0022Loading\u0022 \/\u003E","closeText":"Close"},"modal-popup-large":{"modalSize":{"type":"scale","width":0.8,"height":0.8},"modalOptions":{"opacity":0.9,"background-color":"#CFC8C1"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/[our-website.com]\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022Loading...\u0022 title=\u0022Loading\u0022 \/\u003E","closeText":"Close"},"custom_search":{"form_target":"_self","solr":0}},"merge":true},"#attached":{"css":["sites\/all\/modules\/webform\/css\/webform.css","sites\/all\/modules\/webform_civicrm\/css\/webform_civicrm_forms.css"],"js":["sites\/all\/modules\/webform\/js\/webform.js",{"data":"sites\/all\/modules\/webform_civicrm\/js\/webform_civicrm_forms.js","scope":"footer"},{"type":"setting","data":{"urlIsAjaxTrusted":{"\/modal_forms\/ajax\/webform\/258":true}}}]},"#node":{"vid":"258","uid":"1","title":"Email a

rv0’s picture

@andyg8
Your issue seems completely unrelated to the problem this patch solves.
There could be many things on your site causing this.
Try with a bare drupal install and I think you wont see any issues.

n2itdesigns’s picture

I'm using Modal forms 7.x-1.2 and Webform 7.x-4.12 and can't get the patch to work.

When I opened modal_forms.pages.inc the first thing I noticed is that there was no line 295 which is where the patch says to place it. The part of the code that appears to have the same content as the patch is between lines 241 and 245, which is only 5 lines and the patch mentions 7 lines (both before and after the patch is applied).

I tried adding the patch to both spots in the code but I kept getting this error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /modal_forms/ajax/webform/6
StatusText: OK
ResponseText:
Parse error: syntax error, unexpected end of file in /home/ab4093/public_html/sites/all/modules/modal_forms/modal_forms.pages.inc on line 281

The line mentioned both time is the last line in the code which only contains }

Any help would be greatly appreciated.

rv0’s picture

@n2itdesigns
patches should be applied to the dev version.

n2itdesigns’s picture

I changed to the dev version but now when I click on the button for the pop up menu I now get this:
[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"creative_responsive_theme","theme_token":"ipIw84zJ8HoHli6HdBsAdWaekpOj9qJ7Af1Kj9dTDnk"},"overlay":{"paths":{"admin":"node\/*\/webform\nnode\/*\/webform\/*\nnode\/*\/webform-results\nnode\/*\/webform-results\/*\nnode\/*\/submission\/*\nnode\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"pathPrefixes":[],"ajaxCallback":"overlay-ajax"}},"merge":true},{"command":"modal_display","title":"Webform","output":"No webform found."}]

Any thoughts on what might be causing this.

konrad_u’s picture

@n2itdesigns - like mentioned above I would start from the beginning -> Uninstall the modal forms, if that doesn't work check on fresh D install

Confirming the patch works for confirmation page as well as redirect to custom url

Looks ready to commit to dev

thank you

n2itdesigns’s picture

@konrad_u- I had previously uninstalled modal forms but I tried it again and got the patch to work. Thanks.

n2itdesigns’s picture

I am using webform within the modal form. For some reason the form will not send the results my client's email. I have it set now to send to both my email and my client's email. The confirmation message is showing up and will send to my email but not my client's. They've checked their spam folder and it doesn't show up there at all.

What would be allowing me to receive it but not them? I cloned the email settings from my email to make theirs?

They said they are using a XP computer but the type of OS shouldn't have any effect on them being able to receive and email.

konrad_u’s picture

@n2itdesigns your issue has nothing to do with with modal forms so please don't post it here. Also it's a good idea to reply to your own old comment when you fixed something so people won't keep trying to help you.

onejam’s picture

Patch work for me too. thank you.

dench0’s picture

Also need to replace

$url = trim(ltrim($node->webform['redirect_url'], '/'));
$output[] = ctools_ajax_command_redirect($url);

to the

$output[] = ctools_ajax_command_redirect($form_state['redirect'][0], 0, $form_state['redirect'][1]);

otherwise redirect url with tokens will not work.

millionleaves’s picture

In relation to the comment on #2 about about Webform 3 possibly breaking, I have the patch working for me on a site running Webform 3.24, redirecting to a custom URL without tokens. Thanks for the patch.

rv0’s picture

@millionleaves, thanks for confirming it works on Webform 3.

In that case, this should really be committed :)

netikseo’s picture

The patch was working fine for me until last 2 or 3 days. Now Webform redirects if website is opened on Chrome, however does not redirect if you try to submit it on Firefox or IE. I don't think I changed anything on the website in past several weeks. Anyone having the same issue? What might be a problem?

EDIT: OK, apparently I changed the page a bit. I added some logos below the button with modal form enabled and submission redirect stopped working for IE and Firefox. It's just simple <p style="text-align: center;"> and list of images in a way: <img src="/sites/default/files/xxx.png" style="vertical-align: middle; margin-left: 5px; margin-right: 5px;" width="50">

If anyone can replicate it on their website, we could submit the bug.

hockey2112’s picture

Patch in #2 worked for me, thanks!

grahamC’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
698 bytes

Earlier patch had been working, but on this particular site/form I'm just getting JS errors in Drupal.ajax.prototype.success when trying to submit.

Problem was that the AJAX response array was full of form API junk, and one of the elements (#icon in my case) was set to NULL. This caused an error when trying to dereference response['#icon']['command']

I can see that ctools_modal_wrapper() does return a form instead of an AJAX command if $form_state['executed'] is TRUE:

  if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) {
     return ctools_modal_form_render($form_state, $output);
  }

  return $output;

Attached patch discards the form output in this case.

petednz’s picture

In our set up, on 7.4.12, after submitting the modal form the user then had to click on SAVE and then had to CLOSE

Patch applied cleanly

Outcome now is that when clicking the SUBMIT there is no 'save' option, instead the now 'empty' modal form remains on screen, with no fields now showing, and just a Close link.

For our use case the ideal would be that the Submit is the one and only thing someone needs to do and the modal form disappears from sight - job done. But that may require us to put forward a solution?

netikseo’s picture

Guys, anyone tried to replicate #20?
I implemented the patch for the webform to redirect and it's working when there is no extra text after the button. But as soon as I add any

after the button, the form is not redirected on Firefox or IE.
I tried to put the button into

, clear styles - nothing is working for me. I would appreciate if someone else also tried it and confirmed or denied the bug.

Thanks!

klokie’s picture

works for me, thanks

vbonasa’s picture

Patch in #2 also worked for me, thanks @rv0

drupalgin’s picture

Patch in #2 also worked for me

brtamas’s picture

Hi,

Thanks for patch.
There are some new developments in 7.x.1.x-dev branch that are important to webform work well with multistep settings.

So I have updated your patch to work with this state:
https://cgit.drupalcode.org/modal_forms/commit/?id=8f4bff1b3f676c33dc1e8...

Thanks!

hkirsman’s picture

+1,worked for me

hkirsman’s picture

edit: Deleted the message and patch. It seems the problem was 2 patches conflicting. Why it was working on my local, I don't know.

hkirsman’s picture

robertoperuzzo’s picture

Patch #2 works for me.

webform 4.17
modal_forms 1.2

Tommy_001’s picture

Thanks #2, your patch saved my day. The modal now closes after submission and confirmation message is shown on top of page.
Webform "7.x-4.17"
Modal forms = "7.x-1.2+25-dev"

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

Aside from adjusting the comment to match the Drupal coding standards, this fixes the problem.

DamienMcKenna’s picture

hockey2112’s picture

Will this be added to the latest version of the module?

rodrigoaguilera’s picture

The patches in #28 and #30 both work perfectly.

I am leaving #30 as the default since it doesn't have the header that might not be handled by some patch tools.

Alina Basarabeanu’s picture

Patch #30 works on Drupal core 7.92, PHP 8.0.21 and Modal Forms 7.x-1.2+25-dev version
Is there any chance to get merged into dev or a new stable release for Drupal 7?

renatog’s picture

It really makes sense +1 to RTBC

Is there any chance to get merged into dev or a new stable release for Drupal 7?

Yes, there's. Let's do this!

  • 631d669 committed on 7.x-1.x
    Issue #2598962 by rv0, hkirsman, brtamas, grahamC, n2itdesigns, konrad_u...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moved to the 7.x-1.x branch

Thank you so much everyone for your contribution on this

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.