views:

325

answers:

1

I like the cleanliness of

using (Html.BeginForm())

And hate that adding HTML attributes requires specifying the controller, action, and form method.

using (Html.BeginForm("Action", "Controller", FormMethod.Post,
  new { id = "inactivate-form" })

Is there a way to use Html.BeginForm and specify HTML attributes for the form without manually wiring everything else up?

+2  A: 

Why would you not just use plain html?

<form id="inactivate-form" method="post" >
</form>
Simon Fox
this is exactly what new users of ASP.NET MVC need to understand. It doesn't have to be all code. :)
CodeMonkey
No reason other than trying to follow examples. I prefer your suggested method to `Html.BeginForm`.@CodeMonkey how could you tell I am a new user of ASP.NET MVC? :)
ahsteele
Actually I found the hard way that if you don't use BeginForm you will not get the client-side validation to work as it will not get "hooked up" otherwise.
Philippe Monnet
@Philippe how are you emitting your c-side validation
Simon Fox