简体   繁体   中英

How to add placeholder to joomla contact form

I am designing a template, however, I want my contact form to have placeholders. I tried overriding the contact component form file components/com_contact/views/contact/tmpl/default_form.php but it seems to use joomla JForm or something that doesn't give me the ability to add placeholder directly.

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

How can I add placeholde to the contacts? I definitely don't want to replace those pieces of code with naive html code. Neither I want to add a javascript code to do that (I know it's hard but I want it to be done using Joomla core).

You can add hint="Placeholder name" in 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"
/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM