[AcceptVerbs(HttpVerbs.Post)]
public virtual ActionResult XFormPost(XFormPostedData xFormpostedData)
{
ActionResult thisResult;
if (Request.UrlReferrer == null || string.IsNullOrEmpty(Request.UrlReferrer.Query) || !this.ModelState.IsValid)
{
thisResult = _xformHandler.HandleAction(this);
return thisResult;
}
// Do other stuff
}
At this point the ModelState is always true. If I run _xformHandler.HandleAction(this) it seems to set the ModelState correctly but I don't really know what else this does. For example I don't want it to post the form data. Can anyone clarify what the HandleAction method does and if there is another (more correct way) of validating the model at this point?
Hello,
I'm not having much luck in trying to figure this out. We're on EPiServer 7.5 and I am posting a form from a Block by using code similar to that found here http://cjsharp.com/blog/2013/04/11/creating-a-xform-block-in-episerver-7-mvc-with-working-validation-updated/. This all works okay but in my XFormPost method I want to check if the ModelState is valid before I do anything else.
e.g.
Snippet
At this point the ModelState is always true. If I run _xformHandler.HandleAction(this) it seems to set the ModelState correctly but I don't really know what else this does. For example I don't want it to post the form data. Can anyone clarify what the HandleAction method does and if there is another (more correct way) of validating the model at this point?
Thanks in advance!