1
I’m having difficulty in my web application with Asp.net mvc, of how to create forms using the Razor Engine.
Below follows 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 the Razor Engine, I 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 that I am facing difficulties with tags: class
, placeholer
, required
, and various tags HTML5, as data-alguma-coisa
.
What is the correct way to include these tags in my inputs, using Razor?
Thanks, I was picking up nice and now it all worked out. Thanks for the help.
– Erico Souza