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.
Comment | File | Size | Author |
---|---|---|---|
#6 | webform_redirect_none_message-2199925.patch | 1.57 KB | quicksketch |
Comments
Comment #1
MustangGB CreditAttribution: MustangGB commentedSame 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:
Comment #2
quicksketchThanks 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.
Comment #3
kscheirerWell, 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):
Which should only bother to check $redirect_url if it is set.
Comment #4
MustangGB CreditAttribution: MustangGB commented"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.
Comment #5
jeroen_vreuls CreditAttribution: jeroen_vreuls commentedIn the 3.x version
$redirect_url
was set much sooner in the code, in 4.x it it only set in theelse
which isn't used if no redirect URL is set.I've fixed it by adding
below the line
$external_url = FALSE;
, but I don't know if this works in all cases.Comment #6
quicksketchI'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.
Comment #8
fenstratNeeds porting to 8.x-4.x.
Comment #9
fenstratCommitted and pushed 6774a7f to 8.x-4.x. Thanks!