【问题标题】:In rails, using jquery token input and the tags are not working在rails中,使用jquery令牌输入并且标签不起作用
【发布时间】:2012-08-21 05:54:59
【问题描述】:
<div class="field">
    <%= f.label :author_tokens, "Authors" %><br />
    <%= f.text_area :author_tokens, "data-pre"=> @article.authors.map(&:attributes).to_json %>
  </div>

这是我的令牌字段。所有作者的名字都在这里成功列出。但是当我选择它们时,它们不会被复制到 textarea author_tokens 中。但选项旁边的其他名称被复制到文本字段中。

{"utf8"=>"✓",
 "authenticity_token"=>"4XajxI5Cw59/Oe/Di0vlZKG2wp61/plh12iIs+OrKaI=",
 "article"=>{"name"=>"fdsfds",
 "published_on(1i)"=>"2012",
 "published_on(2i)"=>"8",
 "published_on(3i)"=>"21",
 "author_tokens"=>"",
 "content"=>"fdsfsfds"},
 "commit"=>"Create Article"}

可能是什么问题?

【问题讨论】:

    标签: jquery ruby-on-rails ruby jquery-tokeninput


    【解决方案1】:

    只需将其放在您的 html.erb 文件中即可。

    <% f.text_field :name_of_the_date_column, :value=>Date.today.strftime('%m-%d-%Y'), :id=>"dp5" %>
    

    在 appllication.js 文件中

    $("#dt5").datepicker({
            format: 'mm-dd-yyyy'
        })
    .on('changeDate', function(ev){
      $('#dt5').datepicker('hide');
    });
    

    这对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多