Home > Mobile >  Can't Post TextArea value using WYSIWYG Editor in Razor Pages
Can't Post TextArea value using WYSIWYG Editor in Razor Pages

Time:03-01

I'm developing a .NET Core 3.1 Razor Pages Application. One of the Razor Pages within my app Posts the contents of a TextArea using AJAX. This works as expected, however, when I use CKEditor 5 enter image description here

enter image description here

However, when I make the TextArea into an editor using the CKEditor and attempt to Post data, the data is not posted.

enter image description here enter image description here

Can someone please help?

Thanks.

CodePudding user response:

You need to manually transfer the content of the editor to the form control:

$('#load').on('click', function (evt) {
    evt.preventDefault();
    $('#Input_Narrative').val(CKEDITOR.instances['Input_Narrative'].getData());
       $.post("/MyPage/Index?handler=MyTestPartial", $('form').serialize(), function (data) {
        $("#myPartial").html(data);
       });
  });

https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/saving-data.html#manually-retrieving-the-data

  • Related