Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to send submission values by e-mail #226

Open
maxiorel opened this issue Aug 4, 2023 · 15 comments
Open

Not able to send submission values by e-mail #226

maxiorel opened this issue Aug 4, 2023 · 15 comments

Comments

@maxiorel
Copy link

maxiorel commented Aug 4, 2023

Whenever I' trying to submit a webform with sending an e-mail enabled with submission values including [submission:values] or [submission:values:ANYTHING], I got error and blank screen with logo only:

ArgumentCountError: Too few arguments to function _webform_display_textfield(), 1 passed in /web/htdocs/www.XXXXX.cz/home/www/core/includes/theme.inc on line 1165 and at least 2 expected in function _webform_display_textfield() (line: 213 in file /web/htdocs/www.lkdenta.cz/home/www/modules/webform/components/textfield.inc).

Workaround is sending e-mails without [submission:values] token which is not good solution.

@olafgrabienski
Copy link
Member

Interesting! On my site, I am able to send submission values by e-mail. In my case, the values have the appendix :nolabel, for example: [submission:values:event:nolabel]

Are you using appendixes in your tokens? I'm not sure if they are (supposed to be) necessary, but maybe worth a try.

@maxiorel
Copy link
Author

No luck, just tried and the same error with [submission:values:layout:left:your_name:nolabel]

@olafgrabienski
Copy link
Member

olafgrabienski commented Aug 15, 2023

Hm, what does the layout:left part mean? Is it a fieldset?

@maxiorel
Copy link
Author

It is Layout box (layout) > Fieldset (left) > Field (your_name)

@olafgrabienski
Copy link
Member

Ok, so one idea: Have you tried to use just [submission:values:your_name:nolabel], maybe after moving the webform component outside of any wrapper?

@maxiorel
Copy link
Author

:-) That was my first idea, but no luck.

Anyway, I think the base token [submission:values] should work in any cases. No need to specify each field.

@maxiorel
Copy link
Author

Tried whole new webform without layouts and fields. Still the same problem. Also tried PHP 7.4, 8.0, 8.1, same error.

@maxiorel
Copy link
Author

Quick and dirty fix:
webform.token.inc, line 168. This is problematic:
$replacements[$original] = backdrop_render($submission_renderable);

I've changed it to:
$data = array();
array_walk_recursive($submission->data, function($a) use (&$data) { $data[] = $a; });
$replacements[$original] = implode("\n", $data );

And now [submission:values] token works.

@olafgrabienski
Copy link
Member

Glad to hear you have a fix! I'm still wondering why the submission values didn't work on your site in the first place. (As they work on my site.)

@argiepiano
Copy link

It seems to me that you have a faulty textfield component in your webform, which produces the error. Can you provide more details about the components?

@maxiorel
Copy link
Author

It seems to me that you have a faulty textfield component in your webform, which produces the error. Can you provide more details about the components?

I don't think so. As mentioned above, I created another webform with one textfield only and got the same error if default mailing enabled.

@argiepiano
Copy link

If this is a bug, the only way to fix it is to be able to reproduce it. The info you've provided is not enough to reproduce it. I'm trying on a clean install, with Webform with one textfield component, and the token replacement in the email is working fine. @olafgrabienski also has noticed it's working for him. The only explanation is that you may have something in your site that's interfering with the normal actions.

Do you have any other webform-related contrib installed? Do you have Entity Tokens installed? It may be a good idea to provide a list of contrib modules.

@argiepiano
Copy link

Also what do you mean by "default mailing enabled"?

@argiepiano
Copy link

Have you tried playing with the settings about empty components?
Screen Shot 2023-08-17 at 1 57 06 PM

BTW, re-reading your tokens above - where did you get those "layout:left" tokens? Are those actually listed in the token modal that lists all available tokens? Those do not exist in my installation. Are those produced by a contrib module?

@maxiorel
Copy link
Author

Sorry. I mean default e-mail template for webform submission. Forget my first real life example with layouts. To simplify the problem, I've created simple webform with one (required) textfield only and the problem is the same with default e-mail template. There are not any other modules working with webforms, forms at all or with tokens. The problem occurs in backdrop_render($submission_renderable) as I mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants