Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何使用formtastic为textarea指定值?_Ruby On Rails_Formtastic - Fatal编程技术网

Ruby on rails 如何使用formtastic为textarea指定值?

Ruby on rails 如何使用formtastic为textarea指定值?,ruby-on-rails,formtastic,Ruby On Rails,Formtastic,尝试使用formtastic rails帮助程序为textarea提供一些默认文本。我不能像在其他输入上一样使用值,所以我如何才能做到这一点呢?试试:placeholder=>placeholder\u text我认为这可能是Formtastic中的一个限制或缺少的功能。对于像:string这样的输入,您可以执行:input_html=>{:value=>'which'},但是文本区域的“value”没有设置html属性 尝试一下(我们将:input_html选项向下传递给内置Rails助手,也

尝试使用formtastic rails帮助程序为textarea提供一些默认文本。我不能像在其他输入上一样使用值,所以我如何才能做到这一点呢?

试试
:placeholder=>placeholder\u text
我认为这可能是Formtastic中的一个限制或缺少的功能。对于像
:string
这样的输入,您可以执行
:input_html=>{:value=>'which'}
,但是
文本区域的“value”没有设置html属性


尝试一下(我们将
:input_html
选项向下传递给内置Rails助手,也许他们会做正确的事情),否则,请在Github上提交问题或请求。

不要使用占位符,而是希望默认文本可编辑。我不想让它分散注意力,不管怎样,这是行不通的。您必须使用::input_html=>{:placeholder=>'placeholder Text Here'}@Mladen Danic,它在Formtastic 2.2.1中没有:input_html就可以工作。我从来没有想过尝试一下,我只是假设它不会工作,因为textarea不像输入那样工作。但是,是的,工作非常出色。非常感谢,好先生。