Hello
I am sending test emails to myself using my form and they all come empty.
My website is currently in two languages.
I tried to create a custom confirmation page but when I add an action, the submissions come empty.
Here is my code:
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.
Netlify documentation says I need to add âaction=â/thank-youââ to redirect a user to my custom confirmation page after sending a message using their forms. I do so, and it sends me to the page correctly, but all of the messages come blank even though I know I filled in everything. I removed the action, and it started showing again.
I really canât find anywhere else someone who has had this problem. I have been looking for one for two days
Hey @Paloma,
The action="/thank-you" is example code that assumes your custom confirmation page is called âthank-you.htmlâ- sorry for the misunderstanding there. If you have a confirmation page with a different name, thatâs what should be in the action path, like action="/success" etc. Let us know if that helps!
No, thatâs not what I mean. I have the âthank-you.htmlâ page created. It works, I send a message and it sends me to the page correctly as I mentioned. The problem is that when I add it, all messages I receive in my inbox come blank, no email, name, or message. Once I remove it and re-try, the messages donât come in blank anymore.
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
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?
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â }}"
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?
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)
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!