Empty form submissions due to "action"

paloma, can you post your form code for us please?

yes here it is. thank you for helping

<form class="b-contact-page__form" data-netlify="true" method="POST" name="contact" action="/thank-you">

          <label class="b-contact-page__label" for="name">{{ .form_settings.name }}:</label>

          <div class="b-contact-page__input">

            <input name="name" type="text" id="name" required placeholder="{{ .form_settings.name_placeholder }}">

          </div>

          <label class="b-contact-page__label" for="email">{{ .form_settings.email }}:</label>

          <div class="b-contact-page__input">

            <input name="email" type="email" id="email" placeholder="{{ .form_settings.email_placeholder }}" required>

          </div>

          <label class="b-contact-page__label" for="message">{{ .form_settings.message }}:</label>

          <div class="b-contact-page__input">

            <textarea name="message" id="message" rows="6" required placeholder="{{ .form_settings.message_placeholder }}"></textarea>

          </div>

          <div class="b-contact-page__submit">

            <button type="submit">{{ .form_settings.button_text }}</button>

          </div>

        </form>

Hey @Paloma,
Thanks for clarifying and sharing your form code. It’s possible that the special characters in your action field are breaking our form parser- is it possible for you to hard code the path to the custom thank you/success page instead of using action='{{ T "confirm" }}'?

Well I was using that because my website is in two languages. However I did try without it, as in just the thank-you page, and I was still having the same problem. It is very strange because I can’t find anywhere in these forums someone who has had the same problem

hi paloma, were you able to make any progress on this?

No, nothing… I think it must be a netlify bug

Hey @Paloma :wave:t2:

So this form is still having problems? You’re currently not receiving any submissions from it? I tend to have some luck with Forms and would love to help out. Just wanted to check in first.

Did you remove the action= attribute from the <form> tag in your source code? It doesn’t seem to be making it through the build process (which may be what @jen was meaning — the form parser that runs during the build errors on parsing that field and removed it altogether)

I’m not sure which SSG you’re using, and making a bit of a guess here just assuming you’re using some form of Liquid templating engine, but could you try changing your source code from action='{{ T "confirm" }}' to action="{{ T 'confirm' }}" ? The difference I made there is in swapping the single and double quotes. HTML specifications require that any HTML attribute’s value (that isn’t an unquoted literal) requires the use of double quotes, not single. Your T function should operate no differently with a single-quote argument as well. Can you give that a shot and see if it works?


Jon

Thank you for helping.
I will answer your questions:

You’re currently not receiving any submissions from it?

I receive the submissions, the problem is that they come in blank

Did you remove the action= attribute from the <form> tag in your source code?

In the live website, I removed the action attribute altogether for now in case I receive any emails I don’t want them to be blank.

could you try changing your source code from action='{{ T "confirm" }}' to action="{{ T 'confirm' }}" ?

While I was testing, I tried both action="/thank-you" and action=’{{ T “confirm” }}’, and neither worked, the emails came in blank both times. If action="/thank-you" worked then I’d think the problem would be action=’{{ T “confirm” }}’, but that wasn’t the case…
I’m using Hugo and Forestry for the site.
I tried what you said anyway just in case and the deploy failed, I can’t change it to action="{{ T ‘confirm’ }}"

Interesting that the deploy failed. Let me go ahead and submit a test submission or two and see how the request/response cycle looks from Netlify.

Yes, this was the deploy error:
Error: “/opt/build/repo/layouts/contact/single.html:13:1”: parse failed: template: contact/single.html:13: malformed character constant: ‘confirm’

Interesting. Your form appears to be in good shape and both test submissions appeared to be received just fine. Regardless of whether or not the action= attribute is working, I’m not seeing anything really wrong with your form source, resulting markup, or the penultimate POST request made to Netlify. Did either of my submissions come through with data?


Jon

It worked but that’s because I don’t have the attribute applied right now. I don’t want to risk receiving any blank messages that could be important. If you want, maybe you can tell me what time (and at what time zone) you can test it, and I will make sure to add the attribute 5 minutes before that time. Would that be alright?

Gotcha, I see. That makes sense. Actually could you just run one more test yourself? I’d previously recommended adjusting your markup to action="{{ T 'confirm' }}" but could you actually try

action="{{ T "confirm" }}"

Your editor may highlight it incorrectly (like above) or a linter may parse it with an error, but technically speaking, that should be correct. Liquid parses a file as plain text and replaces what’s inside of {{ and }} - it shouldn’t care about the rest. I think that ought to correctly result in an output of action="/thank-you" (or whatever your T function returns)

Let me know if that works :slight_smile:


Jon

Hello,
The deploy works but the code doesn’t work at all with action="{{ T “confirm” }}".
When I had action=’{{ T “confirm” }}’ it took me to the thank you page but the message came in blank.
With action="{{ T “confirm” }}" it won’t take me to the custom thank you page at all.
I really don’t think the problem is in the markup of the action attribute. I have no idea what it could be instead, though…

Hey @Paloma,
The issue is almost certainly the action attribute. We currently don’t support having a variable in the action field- only a static path. I’ve filed a feature request for this and we can let you know if/when we implement it.

If your framework supports client-side routing (like Gatsby’s navigate), a workaround would be to route to the correct thank you page after the form submission, and ditch the form action field altogether. Sorry we don’t have better news for you today!

1 Like

I don’t think it’s the action attribute because a static path doesn’t work either. Nothing that I try works, all messages come in blank the minute I put in the action attribute, whether it has a variable or a static path.

One more thing you can try is setting the action attribute to a static path as we’ve been discussing AND updating the form name to trigger a new form being created. Let us know if that helps.

that worked… but it’s really unfortunate that I can’t use a variable,since my page is in two languages.

1 Like

A similar issue is happening to me also, sometime after January 14th the netlify forms just stopped accepting submissions (which the client just recently pointed out). The only way that I have found to resolve this issue so far is to completely remove the action="/classes-free-trial/thank-you" from the form, otherwise the form doesn’t even get recognized during the Netlify build post processing. Here is a sample form that used to work and only works now when removing action (renaming form did not work for me):

<form name="Free Trial Page Form" action="/classes-free-trial/thank-you/" method="POST" data-netlify="true">
                <div x-data='{ name: "", subject: "" }'>
                <input type="hidden" name="subject" x-bind:value='subject'>
                <div class="grid grid-cols-12">
                    <div class="col-span-12 mt-2">
                        <label for="name" class="block text-sm font-bold text-gray-700 text-left">
                          Name*
                        </label>
                        <div class="mt-1">
                          <input type="text" x-model='name' name="name" id="name" x-on:click.away='subject = "Free Trial | " + name' autocomplete="name" required class="p-2 shadow-sm focus:ring-yellow-500 focus:border-yellow-500 block w-full sm:text-sm border-gray-400 border-2">
                        </div>
                    </div>
                    <div class="col-span-12 mt-2">
                        <label for="email" class="block text-sm font-bold text-gray-700 text-left">
                          Email*
                        </label>
                        <div class="mt-1">
                          <input type="email" name="email" id="email" autocomplete="email" required class="p-2 shadow-sm focus:ring-yellow-500 focus:border-yellow-500 block w-full sm:text-sm border-gray-400 border-2">
                        </div>
                    </div>
                    <div class="col-span-12 mt-2">
                        <label for="phone" class="block text-sm font-bold text-gray-700 text-left">
                          Phone
                        </label>
                        <div class="mt-1">
                          <input type="tel" name="phone" id="phone" autocomplete="phone" class="p-2 shadow-sm focus:ring-yellow-500 focus:border-yellow-500 block w-full sm:text-sm border-gray-400 border-2">
                        </div>
                    </div>
                    <div class="col-span-12 mt-2">
                        <label for="message" class="block text-sm font-bold text-gray-700 text-left">
                          Message*
                        </label>
                        <div class="mt-1">
                            <textarea id="message" name="message" rows="7" class="p-2 shadow-sm focus:ring-yellow-500 focus:border-yellow-500 mt-1 block w-full sm:text-sm border-gray-400 border-2" required></textarea>
                        </div>
                    </div>
                    <div class="col-span-12 mt-2">
                        <button type="submit" class="mt-4 px-12 py-2 border-2 border-gray-700 font-bebas tracking-widest uppercase text-gray-900 hover:border-yellow-400 hover:text-yellow-400 transition ease-in-out duration-150 mx-auto">
                            Submit
                        </button>
                    </div>
                </div>
              </div>
            </form>

Hiya, sorry you are having trouble getting your forms to work.

This Support Guide is the first port of call to debug any forms issues. There are also many other Support Guides for forms - you can find them here: #Netlify-support:support-guides

We also recommend trying to search the forums or look at topics tagged Netlify forms if you haven’t already - it’s likely your question was already asked by someone else!

If you are still having problems, please provide more information such as what you have already tried, and a link to your live form. :slight_smile: