1
Good afternoon, I have a registration screen that I am making an ajax call to send the data, however when the user does not fill some field I need to show a field validation error message. In other screens of registration of my system I used the @Html.Validationmessagefor to inform validation error however in this case it does not work because I am not doing the post inside Html.BeginForm. Someone could give me a hint as to how I could show a validation error message in the Html.Beginform default without using Html.Beginform?
$.ajax({
url: '/Teste/Save',
data: JSON.stringify(salesmain),
type: 'POST',
contentType: 'application/json;',
dataType: 'json',
autoUpload: true,
success: function (result) {
if (result.success) {
location.reload();
}
else
{
document.getElementById("btnsalvar").disabled = false;
}
}
});
In this case you own one
Model
containing the validation properties (as is done in theHtml.BeginForm()
common) or is a "dry form"?– Thiago Ferreira
@Thiagoferreira Has a Model with the validation properties in the column that uses Html.Beginform().
– Zica