contact-form icon indicating copy to clipboard operation
contact-form copied to clipboard

Additional fields are not sending to mail.

Open pinkrada opened this issue 4 years ago • 6 comments

<div class="row">
                                   <div class="col-lg-6 mb-4">
                                        <input id="from-email" type="email" name="fromEmail"
                                             value="{{ message.fromEmail ?? '' }}" class="form-control"
                                             placeholder="Email">
                                        {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
                                   </div>
                                   <div class="col-lg-6 mb-4">
                                        <input id="phone" type="text" name="message[phone]" value="{{ message[phone] ?? '' }}"
                                             class="form-control" placeholder="{{currentSite.handle == "English" ? "Telephone" : "Téléphone"}}">
                         
                                   </div>
                              </div>

is message[phone] correct?

pinkrada avatar May 02 '20 20:05 pinkrada

yes

uksitebuilder avatar May 06 '20 20:05 uksitebuilder

@pinkrada try removing {{ message[phone] ?? '' }} from your input's value=""

olivierbon avatar May 12 '20 13:05 olivierbon

@olivierbon I am experiencing the same issue. I add this into your example contact form on the README.md and it never passes to the email template:

<h3><label for="test-zach">Test</label></h3>
    <input id="test-zach" type="text" name="message[testZach]" value="{{ message.testZach ?? '' }}">

zachisit avatar Jun 04 '20 12:06 zachisit

@olivierbon I am experiencing the same issue. I add this into your example contact form on the README.md and it never passes to the email template:

<h3><label for="test-zach">Test</label></h3>
    <input id="test-zach" type="text" name="message[testZach]" value="{{ message.testZach ?? '' }}">

Same problem here.

interactivespace avatar Jul 22 '20 13:07 interactivespace

To solve the problem, take a closer look at the documentation. It's not quite easy to see, but the textarea name attribute is actually set to message[body]. If you do, you'll then be able to add message[testZach] on another field and then received it via your email.

<h3><label for="message">Message</label></h3>
<textarea rows="10" cols="40" id="message" name="message[body]">{{ message.message.body ?? '' }}</textarea>

jslyonnais avatar Jul 22 '20 16:07 jslyonnais

Same here

curtismccaw avatar Jul 02 '21 14:07 curtismccaw

Is anyone still having this issue? I’m unable to reproduce it; adding the field below to the example form in the docs and updating the message field to message[body] and all fields show as expected in the email.

<h3><label for="test-zach">Test</label></h3>
<input id="test-zach" type="text" name="message[testZach]" value="{{ message.testZach ?? '' }}">

tommysvr avatar Jan 11 '23 01:01 tommysvr

Will close this out but if anyone is still running into it, let us know.

tommysvr avatar Jan 18 '23 03:01 tommysvr