简体   繁体   中英

Enable html on rails form using formtastic

I would like to enable html input from user on my form.

Tried: = f.input :body, :input_html => {:escape => false} and also {:disabled => false}

Right now the text shows up as a chunk.

if user puts:

Lorem Ipsum is simply dummy text `</br>` of the printing and typesetting industry.

should show up as:

Lorem Ipsum is simply dummy text
of the printing and typesetting industry.

Thank you so much for your help !!

Solved it.

in form f.text_area

added method on model

def body_enable_html
  body.html_safe
end

and called method in views

= @collection_page.body_enable_html

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