Forms Header issue
c
V13.2.2 + UF V13.1.1 I have an Umbraco Form embedded in a page which itself receives a form post from another page to populate some of it's content. When the form is submitted and the page is reloaded to show the "Thank you" message, I get an exception of : "InvalidOperationException: This request does not have a Content-Type header. Forms are available from requests with bodies like POSTs and a form Content-Type of either application/x-www-form-urlencoded or multipart/form-data." I'm happy to do without the originally posted info, but can't work out how to detect "if(no content-type header){}" and let the rest of the page load. If there is a way to have UF pass on the info or a Content-Type header I'd be very pleased to hear it. I doubt ViewData etc, would work in this instance. Any thought? Thanks.
s
What does your rendered
<form>
tag look like.. is
method
missing perhaps.. or a weird
enctype
?
c
Code looks like:-
Copy code
@if (categoryPage.FormPicker.HasValue) {
    @await Component.InvokeAsync("RenderForm", new { formId = @categoryPage.FormPicker.Value, theme = "MyTheme", includeScripts = false })
}
else {
    <h2 style="text-align: center">@categoryPage.Name Enquiry form not found</h2>
}
Which renders a form tag of:-
Copy code
<form action="/make-an-enquiry" enctype="multipart/form-data" id="form7030da16429d4f68a135281f91eaf17b" method="post">
The Umbraco Form posts off fine, the issue is with the original form post that calls the page the Umbraco Form is on. When Umbraco Forms does whatever it does to post the Thank You message, that's when it fails.
s
yeah I am afraid I can't help there, no idea
c
S'ok. As ever in these situations I'm re-engeering to use a discrete "Thank you" page so it doesn't attempt to reload the form page and blow up.
So now it posts off to a Thank You page, it works on local but not on Production. Please see: https://discord.com/channels/869656431308189746/1230941470559571988
151 Views