I have an error when I try to submit my form, I have a message who say something like "ce formulaire n’est pas sécurise. la saisie automatique a été désactivée."
My goal is when the user submit the form, you have the email windows with all the values he wrote.
<form method="get" enctype="multipart/form-data" action="mailto:test.com">
<div class="mb-4">
<label for="fullName"></label>
<input class="border-b border-color-brown shadow appearance-none w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none my-3" id="fullName" type="text" placeholder="Full Name">
<label for="subject"></label>
<input class="border-b border-color-brown shadow appearance-none w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none my-3" id="subject" type="text" placeholder="Subject">
<label for="email"></label>
<input class="border-b border-color-brown shadow appearance-none w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none my-3" id="email" type="email" placeholder="Email">
<label for="comment"></label>
<textarea name="comment" id="comment" class="border-b border-color-brown shadow appearance-none focus:outline-none w-full py-2 px-3 text-gray-700 leading-tight py-2 my-3" placeholder="Comment"></textarea>
</div>
<div class="flex justify-center">
<input class="bg-color-brown hover:bg-color-light-brown text-white font-bold py-2 px-4 rounded text-color-black-brown" type="submit" value="send">
</div>
</form>
2
Answers
I can’t see how this has anything to do with tailwind, besides having tailwindcss classes. The question at best is about html.
But regardless here is an answer.
You can’t achieve that with a form without processing the form input.
The closest you can do is using javascript to create a link to a prefilled email.
Here is an example how to do it from another question
Just because .. I took the time to edit your HTML, and set up a working fiddle that will
mailto
the correct way.. The proof of concept is in theconsole.log
— Here is an actual working example as wellThere is no need to wrap it up in a
<form>
since you’re not usingaction
— You can make a stand alone form. Also thename
attributes are uneccessary as well, since we’re not using<form>
Also since it will be sent directly from the user’s default email client, there is no need for an
email
field.