Gidon Gidon - 10 months ago 83
Javascript Question mvc encode on form post

I'm using a rich text editor in my mvc form (nicedit with a textarea) and when I submit the form on post, because it is not html encoded I get the following message:
"A potentially dangerous Request.Form value was detected from the client" .
How can I html encode the textarea on post ? I don't want to cancel the validation.
Is there a way to use the html.encode helper on submit?

Thank you.

Answer Source

You could decorate the action handling the form post with the ValidateInputAttribute:

public ActionResult SomeActionToHandleFormSubmission()