crespire
Posted on September 24, 2022
Here's a quick one!
I used ActionText and Trix for a Facebook clone project, but I ran into a problem using multiple Trix input areas for different posts and comments on the same page.
When a user had more than one post you could comment on, commenting on one post would cause some issues if you left that comment before saving it to comment or post elsewhere.
The problem is how Trix handles input using a hidden field that contains the real data you'll be saving to your database. It turns out all the different Trix inputs were all writing to the same hidden input field!
The fix was easy once I was able to figure out the issue: each rich_text_area
needed to also have its own unique ID, so that Trix could match each unique input with the corresponding hidden field.
Hope that helps someone working with multiple ActionText inputs on the same page!
Posted on September 24, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.