如何在joomla中为我的表单XML字段添加占位符

时间:2014-10-11 10:33:39

标签: php xml forms joomla

我正在使用Joomla内置注册表单,我在该表单中添加了一些字段。

我需要为我的表单添加占位符,但是"占位符"关键字无效。

registration.xml

<field name="city" type="text" description="Enter your city" 
       label="City" required="true" size="10" filter="string" /> 

3 个答案:

答案 0 :(得分:8)

要添加占位符,您需要添加hint属性,如下所示:

<field name="city" 
       type="text" 
       description="Enter your city" 
       label="City" 
       required="true" 
       size="10" 
       filter="string"
       hint="Placeholder here" />

希望这有帮助

答案 1 :(得分:2)

edit.php 中为特定字段添加此内容:

JHtml::_('formbehavior.chosen','#jform_fieldname', null, array('disable_search_threshold' => 0, 'placeholder_text_multiple' =>'placeholder Value'));

答案 2 :(得分:-1)

<field name="mytextvalue" type="text" label="Enter some text" hint="Some placeholder about the field" />

有关详细信息,请查看Joomla文档 https://docs.joomla.org/Text_form_field_type/3.2