RenderAction has stopped considering fields marked as [Required]
in my models.
Example of one of the models:
private uint IdNews { get; set; }
[Required(ErrorMessage = "Defina o título.")]
public string Title { get; set; }
[UIHint("tinymce_jquery_full"), AllowHtml]
[Required(ErrorMessage = "Escreva a descrição.")]
public string Description { get; set; }
//[RegularExpression(@"^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$", ErrorMessage = "A data é inválida.")]
[Required(ErrorMessage = "Selecione a data de postagem.")]
public DateTime PostDate { get; set; }
[Required(ErrorMessage = "Escreva o nome do Administrador que esta postando.")]
public Admin AdminName { get; set; }
public Image Photo { get; set; }
This is the view that is being loaded with the Hrml.RenderAction:
@model BraveryBranded.ASP.Models.News
@{
ViewBag.Title = "Adicionar";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>Nova Notícia</legend>
<div class="editor-label">
<h3>*Título</h3>
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
<div class="editor-label">
<h4>Imagem</h4>
</div>
<div class="editor-field">
<input type="file" id="file"/>
</div>
<div class="editor-label">
<h4>*Descrição:</h4>
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>
<br/>
<p>
<button class="btn btn-primary" type="submit">Adicionar</button>
</p>
</fieldset>
}
@*<div>
@Html.ActionLink("Back to List", "Index")
</div>*@
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
View where the RenderActions are loaded:
@using BraveryBranded.ASP.Models
@model IEnumerable<BraveryBranded.ASP.Models.News>
@{
ViewBag.Title = "Notícias";
}
<h2>@ViewBag.Title</h2>
@{
Html.RenderAction("New", "News");
}
<hr/>
@{
Html.RenderAction("List", "News");
}