Skip to content
Advertisement

getting errolist when using htmx and tinymce

Im trying to implement post request with htmx and for rich text editor using tinymce.

my form :

JavaScript

The error I get :

JavaScript

it works just ok when I used the traditional post request with TinyMCE.

when I used htmx without TinyMCE its work just fine too.

it just when I combine htmx and TinyMCE I get the error.

my tinymce init:

JavaScript

Advertisement

Answer

Here is what solved this particular issue for me.

In this case the tinyMCE.triggerSave() method was not being triggered when the HTMX event fires. So what you need to do is call the method during one of your HTMX pre-request events. In this case I used htmx:configRequest event, however there may be better HTMX events to use.

Example:

JavaScript

Because of the way the HTMX events fire, the form values have already been collected once the htmx:configRequest event fires, so you need to update the fields value in the request. There maybe some better ways of doing this, but this is working for me.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement