I'm having trouble with my web application with asp.net mvc, how to create forms using the Razor Engine.
Below is my HTML code.
<form class="o-form" method="post">
<input name="senderName" id="senderName" required="required" type="text" placeholder="Nome*">
<input type="email" name="senderEmail" id="senderEmail" required="required" placeholder="Email*">
<input type="text" placeholder="website">
<textarea name="message" id="message"></textarea>
<button type="submit" class="btn-small btn-center">Send</button>
</form>
To use Razor Engine, I have tried the following:
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
@Html.EditorFor(model => model.Nome)
@Html.ValidationMessageFor(model => model.Nome)
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
@Html.TextAreaFor(model => model.Mensagem)
@Html.ValidationMessageFor(model => model.Mensagem)
<button type="submit" class="btn-small btn-center">Send</button>
}
And in this I am facing difficulties with the tags: class
, placeholer
, required
, and several HTML5 tags, such as data-alguma-coisa
.
What is the correct way to include these tags in my inputs, using Razor?