This applies to 7.x-4.0-beta3+24-dev.

In webform_client_form_submit(), at the very bottom is logic for determining the redirect location and message.
When the redirection location is set to 'none', $redirect = NULL and $redirect_url is not set.
No message is displayed due to the following condition:

if (!$is_draft && !$external_url && (!empty($redirect_url) && $redirect_url != '<confirmation>') && !empty($confirmation)) {
  drupal_set_message(check_markup(webform_replace_tokens($confirmation, $node), $node->webform['confirmation_format'], '', TRUE));
}

I believe that the message should still be displayed in a drupal_set_message(). The empty($redirect_url) is not be needed, since what you're trying to avoid is the condition where it is set to ''.

(!$is_draft && !$external_url && $redirect_url != '<confirmation>' && !empty($confirmation)) works for me, but I'm not familiar enough with the module to be sure.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MustangGB’s picture

Same issue for me, the problem with removing empty($redirect_url) and not replacing it is you get and undefined variable notice.

I think this is what was trying to be achieved:

- elseif (!$is_draft && !$external_url && (!empty($redirect_url) && $redirect_url != '<confirmation>') && !empty($confirmation)) {
+ elseif (!$is_draft && !$external_url && !(isset($redirect_url) && $redirect_url == '<confirmation>') && !empty($confirmation)) {
quicksketch’s picture

Thanks guys, I've confirmed this issue. Unfortunately I couldn't get the suggestion in #1 to work. This code could definitely use a little work to make it more readable/maintainable.

kscheirer’s picture

Well, when that code is executed, $redirect_url is not set, so both empty() and isset() return the same value.

So I think the final condition should be (not tested):

if (!$is_draft && !$external_url && (isset($redirect_url) && $redirect_url != '<confirmation>') && !empty($confirmation)) { ... }

Which should only bother to check $redirect_url if it is set.

MustangGB’s picture

"Which should only bother to check $redirect_url if it is set."

Actually no because it will also return FALSE if $redirect_url isn't set, whereas we need it to return TRUE in order that the message gets displayed.

jeroen_vreuls’s picture

In the 3.x version $redirect_url was set much sooner in the code, in 4.x it it only set in the else which isn't used if no redirect URL is set.

I've fixed it by adding

$redirect_url = $node->webform['redirect_url'];

below the line $external_url = FALSE;, but I don't know if this works in all cases.

quicksketch’s picture

Status: Active » Fixed
FileSize
1.57 KB

I've tested out this patch to solve this problem. It basically uses the suggestion by @jeroen_betawerk and just defines $redirect_url much earlier in the function call, so the variable exists when it's checked at the bottom of the function. This seems to fix the problem with the message not showing up when the confirmation location is set to no redirect, and other modes (confirmation page, local redirect) all seem to work as expected. I've committed this to the 7.x-4.x branch and it'll be in the next release. Please let me know if this patch doesn't (or does) solve the problem.

  • Commit 6774a7f on 7.x-4.x by quicksketch:
    Issue #2199925: Message not displayed when Redirection location is 'none...
fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Fixed » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed 6774a7f to 8.x-4.x. Thanks!

  • Commit be4fce1 on 8.x-4.x authored by quicksketch, committed by fenstrat:
    Issue #2199925 by quicksketch: Message not displayed when Redirection...

Status: Fixed » Closed (fixed)

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