First of all, I really appreciate all the packages Brandon has created. I really own him a beer. This is the first time I’ve attempted to use his Sage HTML Forms package and I’m having some issues with it. Hope someone has some more experience with it than I do and can help out.
Ok, so I’ve created a contact form:
<x-html-forms :form="$form" id="contact" class="flex flex-wrap w-full space-y-8" > <div class="space-y-8 lg:space-y-0 lg:flex lg:space-x-8 w-full"> <div class="w-full lg:w-1/2"> <input name="name" type="text" class="w-full border border-pantone-285c-30 px-4 py-2 placeholder-gray-500" placeholder="Name..." required > </div> <div class="w-full lg:w-1/2"> <input name="email" type="email" class="w-full border border-pantone-285c-30 px-4 py-2 placeholder-gray-500" placeholder="Email Address..." required > </div> </div> <div class="flex space-x-8 w-full"> <div class="w-full"> <textarea name="message" class="w-full border border-pantone-285c-30 px-4 py-2 placeholder-gray-500" placeholder="Please tell us how we can help you..." rows="6" required ></textarea> </div> </div> <div class="flex w-full justify-end"> <input type="submit" value="Submit" class="btn-md bg-white hover:bg-opacity-80 cursor-pointer border border-pantone-285c-30 " /> </div> </x-html-forms>
This automatically produces this in the HTML Forms plugin:
When submitting a form with the following settings, the form processes and saves the form submission in the submissions tab as it should with all the field data. However, the form is not hidden and the inputs still container the data.
If instead I redirect to a /thank-you page, the form is cleared after submitting, the thank you message appears and then it successfully redirects me to my thank you page.
The major problem here is with the emails. They’re being sent with empty bodies.
This is how I’ve setup my action to send an email:
According the the brief documentation on this package, Brandon mentions:
When HTML Forms processes "Form Actions" – it simply fetches each input name to create the usable variables. That being said, the default view would provide `[NAME]` and `[EMAILADDRESS]` .
So it appears I’ve done everything correctly. Does anyone have any idea whats up? Kindly-