I have a form with multiple TinyMCE editors. Some of the editors are advance and some are simple editors. I have used jquery validation plugin for validation in client-side.
f you have Html editor tinymce the required validation is not working ok, you can use this code to solve your problem, install tinymce in your application if you have more than one Htmleditor you can do this i know this is proper solution but you can do it and solve this problem
In model give the path of tinymce.cshtml page ok
[Required(ErrorMessage = "Please enter About Company")]
[Display(Name = "About Company : ")]
[UIHint("tinymce_jquery_full"), AllowHtml]
public string txtAboutCompany { get; set; }
[Required(ErrorMessage = "Please enter About Company")]
[Display(Name = "About Company : ")]
[UIHint("tinymce_jquery_full"), AllowHtml]
public string txtAboutCompany { get; set; }
Now in your view add one span like this
@Html.LabelFor(model => model.txtAboutCompany, new { @class = "required" })
@Html.EditorFor(model => model.txtAboutCompany)
@Html.LabelFor(model => model.txtAboutCompany, new { @class = "required" })
@Html.EditorFor(model => model.txtAboutCompany)
Create jQuery on submit button click event
$("#BusinessProfile").click(function () {
var aboutC = $("#txtAboutCompany").val()
var pinfo = $("#txtProductinfo").val();
if (aboutC == "" && pinfo == "") {
$("#AC").append("").val("").html("Please enter about company")
$("#PI").append("").val("").html("Please enter product information")
$("#bpform").valid();
return false;
} else if (aboutC == "") {
$("#PI").append("").val("").html("")
$("#AC").append("").val("").html("Please enter about company")
$("#txtAboutCompany").focus();
$("#bpform").valid();
return false;
} else if (pinfo == "") {
$("#AC").append("").val("").html("")
$("#PI").append("").val("").html("Please enter product information")
$("#txtProductinfo").focus();
$("#bpform").valid();
return false;
}
else {
$("#AC").append("").val("").html("");
$("#PI").append("").val("").html("");
//return true;
$("#bpform").validate();
}
});
i hope your problem may be solve