enigmadigital / Formerly

Plugin to allow users to create custom forms within Craft CMS
MIT License
59 stars 24 forks source link

Checkbox value display in mail - Bug? #74

Closed iDzine closed 8 years ago

iDzine commented 8 years ago

I have used this plugin on multiple sites, without a problem, but on a new site I'm facing an issue in 1 of my 3 forms created within formerly.

In this particular form I'm also using Checkboxes where people can choose from. If I display this handle in the mail that will be send after form submissions this will be blank. Also the form redirection is going wrong, instead of the ?ok=1 url, it goes to the same url it came from without the ?ok=1 and also without any formatting of the page AND no mail is send afterwards.

I'm guessing this is a bug somewhere in the code as in the submission all the selected checkboxes are filled out.

If I'm mremoving the checkbox handle from the mail body, the redirect is working perfectly, the mail is also send and the submission is ok, Only thing missing is the checkbox value in the mail...

Any idea?

wiso1234 commented 8 years ago

A few people are reporting this bug. It's because the email templater only handles scalar form values. The checkbox is an array of values.

So I guess to fix this we'd need to convert the array to a string before passing it to the template. What are people expecting this string to be like? I'm guessing a comma seperated list of values

iDzine commented 8 years ago

As long as the input is visible it's fine for me. If I look into the formerly submitted form in the control panel, it's already comma seperated. It would be nice to get these values under each other, by for example adding a
, but again, if it's visible in the mail by comma seperated is fine also :)

wiso1234 commented 8 years ago

I've fixed the template filtering code to allow twig filters to be used. So now you can add {mycheckboxlist|join(',')}

iDzine commented 8 years ago

Hi Wiso, just tested it by adding the code in the form within formerly and it works like a charm! good job!!!