开发者

how to make f.text_field+"<div>there is a error</div>" work

开发者 https://www.devze.com 2023-01-14 04:54 出处:网络
I write a helper method in applicationhelper something like this str = f.text_field(:username) + \"<div clas开发者_开发技巧s=\'error\'>username is wrong </div>\"

I write a helper method in applicationhelper something like this

str = f.text_field(:username) + "<div clas开发者_开发技巧s='error'>username is wrong </div>"

then in my view.rhtml it shows like this

<input type="text" value="" size="30" name="user[username]" id="user_username">     &lt;div class="errors"&gt;username is wrong&lt;/div&gt;     

any helps? Thx!


str = f.text_field(:username) + "<div class='error'>username is wrong </div>".html_safe
0

精彩评论

暂无评论...
验证码 换一张
取 消