Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7566355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:23:27+00:00 2026-05-30T14:23:27+00:00

I have two models: Post and Tag. The Post model has an attr_accessor called

  • 0

I have two models: Post and Tag. The Post model has an attr_accessor called :tag_name and the Tag model has an attribute called :name.

I have this form:

<%= form_for(@post) do |f| %>
  <%= render 'shared/error_messages' %>
  <div class="field">
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :content %><br />
    <%= f.cktext_area :content %>
  </div>
  <div class="field">
    <%= f.label :tag_name %>
    <%= f.autocomplete_field :tag_name, autocomplete_tag_name_posts_path, :"data-delimiter" => ' ' %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

This is the output of the field:

<input data-autocomplete="/posts/autocomplete_tag_name" data-delimiter=" " id="post_tag_name" name="post[tag_name]" size="30" type="text">

I want the user to see the name of the tags as soon as they enter the show view.

Any suggestions of how to accomplish this?

EDIT:

I tried putting this at the end of the form:

<script type="text/javascript">
  $('#post_tag_name').val($('#post_tag_name').val() + <%= render @post.tags %>);
</script>

But nothing happens

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:23:29+00:00Added an answer on May 30, 2026 at 2:23 pm
    $('#post_tag_name').attr('value', '<%= render @post.tags %>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if I have two simple models: class Tag(models.Model): name = models.CharField(max_length=100) class Post(models.Model): title
I have two models related one-to-many: a Post and a Comment : class Post(models.Model):
I have two models, Article and Post that both inherit from a base model
If I have two models in Django: class Blog(models.Model): author = models.CharField() class Post(models.Model):
Let's say you have two models: Post and Category . Each Post has a
I have two models ForumThread and Post set-up like this: class ForumThread < ActiveRecord::Cached
I have two models, post and comment. Posts has many comments and comments belongs
I have two models: class Studio(models.Model): name = models.CharField(Studio, max_length=30, unique=True) class Film(models.Model): studio
I have two models, Room and Image . Image is a generic model that
I have two models: Show and Venue . Show has one venue while each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.