If I have a text field on the form and someone enters '0' (a zero without quotes) for that field, then '0' will not be displayed for that field when the custom email template contains:
%email_values
It displays as:
test field: (no value displayed)
When it should display as:
test field: 0
But putting %value[test_field] in the template does display correctly as:
'0' (no quotes).
This is easy to replicate.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | webform_email_zero_value-1897978.patch | 508 bytes | quicksketch |
| #2 | webform_1897978_email_zero_value.patch | 351 bytes | liam morland |
Comments
Comment #1
druderman commentedThe problem is in theme_webform_element_text() at this point $value is '0' which evaluates to false.
One quickie workaround is to change it before it's rendered. Alternately, I could have recreated most of the code in my theme function. The real fix is to check if $value === 0.
Comment #2
liam morlandHere is a simple patch that fixes this issue.
Comment #3
quicksketchHi guys, thanks for the report. I'm not sure what the purpose of that conditional is for at all. Seems like the whole statement could just be deleted. I've committed this patch. Thanks!