如何添加占位符到joomla联系表单

时间:2015-02-21 07:58:19

标签: php joomla

我正在设计模板,但是,我希望我的联系表单有占位符。我尝试覆盖联系人组件表单文件components/com_contact/views/contact/tmpl/default_form.php但似乎使用joomla JForm或者某些东西不能让我直接添加占位符。

$this->form->getInput('contact_name');
$this->form->getInput('contact_email');
...

如何在联系人中添加placeholde?我绝对不想用天真的HTML代码替换那些代码片段。我不想添加一个javascript代码来做到这一点(我知道这很难,但我希望使用Joomla核心来完成)。

1 个答案:

答案 0 :(得分:1)

您可以在hint="Placeholder name"

中添加components/com_contact/models/forms/contact.xml
<field
    name="contact_name"
    type="text"
    label="COM_CONTACT_CONTACT_EMAIL_NAME_LABEL"
    description="COM_CONTACT_CONTACT_EMAIL_NAME_DESC"
    id="contact-name"
    size="30"
    filter="string"
    required="true"
    hint="Placeholder name"
/>