avo
avo copied to clipboard
Tags Field Clears on Form Error in New and Create Actions Using acts_as_taggable_on
Describe the bug
When submitting a form for creating or updating a Resource, if the form encounters an error and re-renders, the tags field does not remember the previously entered tags and appears empty. This issue occurs with tags in a model using acts_as_taggable_on.
Steps to Reproduce
- Navigate to the 'new Resource' page for a resource with
acts_as_taggable_onand the tag field configured. - Fill out the form including some tags in the 'tags' field.
- Intentionally make a mistake in another field to cause the form submission to fail.
- Submit the form.
- Notice that upon form error, the 'tags' field is rendered empty instead of displaying the previously entered tags.
Expected behavior & Actual behavior
Expected behavior: After form submission errors, the 'tags' field should display the tags that were entered prior to submitting the form.
Actual behavior: The 'tags' field is empty after the form re-renders due to validation errors.
Models and resource files
# resource file:
field :tags, as: :tags, acts_as_taggable_on: :tags,
close_on_select: false,
suggestions: -> { PodcastEpisode.tags_suggestions },
enforce_suggestions: true,
only_on: %i(new show edit)
# model file
class PodcastEpisode < ApplicationRecord
acts_as_taggable_on :tags
# Additional model configurations and methods...
end
System configuration
Avo version: v3.6.0
Rails version: 7.0.4
Ruby version: ruby-3.1.2
License type:
- [ ] Community
- [x] Pro
- [ ] Advanced
Are you using Avo monkey patches, overriding views or view components?
- [ ] Yes. If so, please post code samples.
- [x] No
Screenshots or screen recordings
Additional context
Impact
- [ ] High impact (It makes my app un-usable.)
- [x] Medium impact (I'm annoyed, but I'll live.)
- [ ] Low impact (It's really a tiny thing that I could live with.)
Urgency
- [ ] High urgency (I can't continue development without it.)
- [x] Medium urgency (I found a workaround, but I'd love to have it fixed.)
- [ ] Low urgency (It can wait. I just wanted you to know about it.)
Thanks for reporting. We'll check on our end next week.
This issue has been marked as stale because there was no activity for the past 15 days.
Can you please check the latest version @artero and let us know if this still happens?
Hi @adrianthedev, I tested version 3.7.4. I'm still experiencing the same issue.