I have simple contact form:
<form id='contactform' action="{{ path('app_contact_send') }}" method="POST" name="contactform">
<ul class="form-cover">
<li class="inp-name">
<label>Nombre * (requerido)</label>
<input id="name" type="text" name="your-name">
</li>
<li class="inp-text">
<label>Mensaje * (requerido)</label>
<textarea id="mess" name="mess"></textarea>
</li>
<li class="inp-email">
<label>E-mail * (requerido)</label>
<input id="email" type="email" name="your-email">
</li>
</ul>
<div class="btn-form-cover">
<button id="#submit" type="submit" class="btn">enviar</button>
</div>
</form>
After clicking the submit button I have a controller that gathers data from the from:
$name = $request->request->get('name');
$from = $request->request->get('email');
$mess = $request->request->get('mess');
Then use the data to sent an email with symfony mailer in a POST method in the controller:
$email = (new Email())
->from($from)
->replyTo($from)
->to('[email protected]')
->cc('[email protected]')
->bcc('[email protected]')
->replyTo($from)
->subject('Mensaje desde www.website.com')
->text(sprintf('Mensaje enviado: %s, por: %s.', $mess, $name));
Email is sent but variable 'mess' gathered form textarea is always empty, name and email have values.
Is anything more I have to do for textarea type fielsds?
Requests are managed by Symfony UX Turbo.
variable mess should have a value.
I did track this down to a js file where the mouse click is being captured, the form values posted to an array.
Modify this to match the fields on the form.
This solve the problem.