Wednesday, 2 October 2013

How do you get BeginForm to use a standard accept-charset by default?

How do you get BeginForm to use a standard accept-charset by default?

I have a website I manage that has a lot of content. Since we do have to
deal with international characters, I want all my forms to have the
accept-charset="utf-8" attribute. Right now I have to remember, and have
my team remember to set that explicitly on every form in our website:
@using (Html.BeginForm(null, null, FormMethod.Post, new { accept_charset =
"utf-8" })) {
<!-- content of form -->
}
I want to be able to configure the whole site to put that in by default.
In short I want this code:
@using (Html.BeginForm()) {
<!-- content of form -->
}
to generate this HTML:
<form action="/Teaching/Edit/2522" method="post" accept-charset="utf-8">
<!-- content of form -->
</form>
I haven't been able to find anything to let me do that.

No comments:

Post a Comment