简体   繁体   中英

How to get the input value on Formtastic's hint?

我有一个Formtastic表单,并希望它在提示中显示一个链接,如果有的话。

f.input :link, hint: 'link here'

The solution I found to solve this was to use f.object and then call the attribute link on it, like so:

  form do |f|
    f.inputs do
      f.input :link, hint: link_to(f.object.link, f.object.link)
    end
    f.actions do
      f.action :submit
    end
  end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM