Surface controller calls GET instead of POST in submit
Hi,
In a project I have a form on a partial view that gets rendered through a surface-controller.
The form is made using Html.BeginUmbracoForm("action", "controller").
When I click on the submit button I expect to be led to the POST-method, but everytime I return to the GET-method instead.
public class ForgotPasswordSurfaceController : SurfaceController {
[ChildActionOnly]
public ActionResult ForgotPasswordRenderForm()
{
ForgotPasswordViewModel model = new ForgotPasswordViewModel();
return PartialView("Profile/Forgotpassword", model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ForgotPasswordPost(ForgotPasswordViewModel model)
{
if (ModelState.IsValid)
{
// send mail to reset password
TempData["Status"] = "success";
TempData["StatusMessage"] = "A mail is send to this email address to reset the password";
return CurrentUmbracoPage();
}
return CurrentUmbracoPage();
}
}
But I found the problem: I was using a theme made by somebody else for this site and when reading into the Html closer I found a really hidden extra form tag. A form within a form doesn't work so removing that was the solution.
(make a note to myself: read all the external code you use very close)
Surface controller calls GET instead of POST in submit
Hi,
In a project I have a form on a partial view that gets rendered through a surface-controller. The form is made using Html.BeginUmbracoForm("action", "controller"). When I click on the submit button I expect to be led to the POST-method, but everytime I return to the GET-method instead.
Here's the view that includes the partial:
The partial looks like:
And this is the Surfacecontroller:
Can anyone see what I am doing wrong here?
thanks,
Frans
Hi,
Have you tried adding a FormMethod to your form?
-Joep
Hi Joep,
Yes, I have tried that. Unfortunately it made no difference.
thanks,
Frans
Hi Frans
How about trying the following:
Cheers
Nigel
Hi Nigel,
Thanks, this didn't work either.
But I found the problem: I was using a theme made by somebody else for this site and when reading into the Html closer I found a really hidden extra form tag. A form within a form doesn't work so removing that was the solution. (make a note to myself: read all the external code you use very close)
cheers,
Frans
is working on a reply...