ppetrov
Hello,
This is my actual first attempt to write a form with external html editor in textarea field.
That i have done:
-
I generated the form using:
mix phx.gen.html Content Article articles heading:string tag:string slug:string article:text -
Updated ecto
-
Added the CKeditor in in root.html.heex using:
-
I have added the additional script from here within the article_form.html.heex and i can see the field updated and i can use the editor.
The problem:
When i press submit it gives me error that the field is empty.
What i tried:
I am very bad in JS so please be understanding. I got the idea that i have to collect the data from the editor and ‘send/push’ it to the form somehow (my guess is to the id of the original field) but i can’t get it to work. I have read few other topics from here but i don’t really get how to make it work.
I will appreciate if someone can guide me to the solution.
Regards,
Peter
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
TwistingTwists
Can you show some code?
Have you done phx-update=ignore ?
ppetrov
Hey TwistingTwists,
I have not done any phx-update changes. That is all my code in the form. I am not sure even where to put that.
ppetrov
Sorry, the console.log was me trying to see if something comes out. The actual line is:
TwistingTwists
Are you aware about JS hooks ?
ppetrov
The problem with that is i am not sure how they are suppose to work exactly. I guess i have to dig into it and see what i can do.
ppetrov
OK, so i figured it out. The editor is expecting to have the textarea instead of text field type. If i change it in the form then all works just fine.
Wigny
This blog post may be useful to guide you how to setup the editor.
ppetrov
Thanks. That will be an upgrade that i might want to do. Funny enough that is a paid feature on the ck editor and with some additional coding it could make it even better than the paid service.
Mati365
I recently made integration to simplify usage of the editor. It should be much more intuitive.
https://github.com/Mati365/ckeditor5-phoenix