DEV Community

crespire
crespire

Posted on

2 1

Rails: Using Lots of ActionText Inputs on the Same Page

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!

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more