【问题标题】:How to add placeholder for my form XML fields in joomla如何在 joomla 中为我的表单 XML 字段添加占位符
【发布时间】:2014-10-11 10:33:39
【问题描述】:

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

我需要为我的表单添加占位符,但“占位符”关键字不起作用。

registration.xml

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

【问题讨论】:

  • registration.xml

标签: php xml forms joomla


【解决方案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

【讨论】:

    【解决方案2】:

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

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

    希望对你有帮助

    【讨论】:

    • 在 Joomla 2.5 中“提示”关键字不起作用。它在 Joomla 3.0 中正常工作。?是什么原因 ?甚至占位符关键字都不起作用。 ?
    • 我相信这个功能是在 Joomla 3.x 中添加的。对于 Joomla 2.5,您需要创建一个覆盖标准“文本”的自定义表单字段:docs.joomla.org/Form_field#Custom_form_field_types
    • 好的@Lodder。但是告诉我如何更改注册按钮名称。我很累,但我没有得到 ant 链接或任何样式表,请帮助
    • 注册按钮名称?如果这与您当前的问题不同,请提出一个新问题。
    【解决方案3】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-29
      • 1970-01-01
      • 2019-10-09
      • 2017-10-23
      • 2012-11-11
      • 2019-02-03
      • 1970-01-01
      • 2015-07-01
      相关资源
      最近更新 更多