View Component submit Form not performing a redirect
Hi,
I have a view component which has a simple form on it to sign people up to my marketing emails. This form is wrapped with the Begin Umbraco Form which posts the email to a surface controller. Within the surface controller method it saves the email address and then returns a Redirect to Umbraco Page.
I can see in the network tab that the thank you page is being called but for some reason the page is not displaying and I am just remaining on the page I submitted the email from.
I have also tried just returning CurrentUmbracoPage and Setting a ViewData object and wrapping the form so that if it is set to true show a thank you message but that didnt work either
That did not work sorry. I can see the call and redirect in the network tab of developer tools, but it is as if the view component is preventing it from redirecting?
I managed to work out the issue. The way I was building up the razor for the UmbracoBeginForm was causing an issue and creating the post as an xhr type. So it was working but then it wasn't actually creating a redirect.
I have now fixed the razor and the form now posts and redirects me to an umbraco page as intended.
View Component submit Form not performing a redirect
Hi,
I have a view component which has a simple form on it to sign people up to my marketing emails. This form is wrapped with the Begin Umbraco Form which posts the email to a surface controller. Within the surface controller method it saves the email address and then returns a Redirect to Umbraco Page.
I can see in the network tab that the thank you page is being called but for some reason the page is not displaying and I am just remaining on the page I submitted the email from.
Please could somebody help?
Regards, Jay
I have also tried just returning CurrentUmbracoPage and Setting a ViewData object and wrapping the form so that if it is set to true show a thank you message but that didnt work either
IIRC I set a TempData[""] variable and do a
return RedirectToCurrentUmbracoPage()
That did not work sorry. I can see the call and redirect in the network tab of developer tools, but it is as if the view component is preventing it from redirecting?
I managed to work out the issue. The way I was building up the razor for the UmbracoBeginForm was causing an issue and creating the post as an xhr type. So it was working but then it wasn't actually creating a redirect.
I have now fixed the razor and the form now posts and redirects me to an umbraco page as intended.
Thanks for you help.
is working on a reply...