class name in BeginFormAntiForgeryPost()

Topics: Writing themes
Jan 23, 2012 at 11:28 PM

Hello,

Is there a way to add a style class to the Html.BeginFormAntiForgeryPost()? I tried Html.BeginFormAntiForgeryPost(new { @class = "form-stacked" }), but I'm missing some arguments apparently and I can't seem to figure out what they might be or if the tag will even take a class addition.

Thanks

Coordinator
Jan 25, 2012 at 4:10 AM

Do a regular form and add the anti-forgery field yourself with Html.AntiForgeryTokenOrchard()

Developer
Jan 6, 2014 at 5:27 PM
Updating this old post. This can be done with one of the Html.BeginFormAntiForgeryPost overloads, ie.
@using (Html.BeginFormAntiForgeryPost(Url.Action("Action", "Controller", new { area = "Module" }), FormMethod.Post, new { @class = "my-form-class" })) 
{ 
    ... 
}
Jan 7, 2014 at 6:59 PM
That's the solution I've been using Piotr. Thanks for posting the actual code though...I probably should have done that so others would have it as well =)