0

I am using AllowHtml for CKeditor in my model and i have also assign Required field, but validation not working, my model is Like :-

    [Display(Name = "Introduction Details:")]
    [Required(ErrorMessage = "Introduction Details is required.")]
    [AllowHtml]
    public string Introduction { get; set; }   
Tejas
  • 9
  • 2
  • You need to reconfigre the validator - refer [this answer](https://stackoverflow.com/questions/26379307/jquery-chosen-dropdown-validation-client-site-doesnt-work/26392882#26392882) –  Nov 06 '17 at 08:15
  • Take a look at this post https://stackoverflow.com/questions/4491316/ckeditor-and-asp-net-mvc-3-requiredattribute –  Nov 06 '17 at 10:59

1 Answers1

0
<script type="text/javascript">
    $(document).ready(function () {
        $('#CkEditor1').ckeditor();
        $('#Testimonials_error').hide();

    });
    function GetCKEditorData() {
        var data = $('#CkEditor1').val();
        if (data != "") {
            var c = confirm("Do you want to save this record");
            if (c) {
                window.location.href = "/Admin/Testimonials";
            }
        }
        else {
            $('#Testimonials_error').show();
            return false;
        }
    }
</script>
Tejas
  • 9
  • 2