Jump to content

Recommended Posts

Posted (edited)

I would like to add placeholder attributes to the registration form as members constantly enter the wrong information in the custom fields. I am talking about the greyed out wording in the form boxes that stays there until the user enters their text. Can anyone tell me where to enter the placeholder html code for the custom fields?

 <input type="text" name="fname" placeholder="First name"><br>
  <input type="text" name="lname" placeholder="Last name"><br>

placeholder.png.6de46f302068abf9974d1c733cd37619.png

Thanks

Edited by Genestoy
Posted (edited)

There must be somebody out there that knows how to do this? IPS uses it in the search box

 

Thanks in advance for any help

search.png

Edited by Genestoy
Posted

From an HTML perspective it's easy, you just add placeholder="Whatever you want"

The problem is that custom fields use very very central generic HTML templates, so you can't simply edit a template to make it show the value you want. You could probably do something like

{{if $name == 'core_pfield_123'}}
placeholder="First Name"
{{elseif $name == 'core_pfield_456'}}
placeholder="Last Name"
{{endif}}

Or perhaps create a plugin that has a small javascript mixin which does this, but I don't think I'd bother personally.

Posted

Thanks for the reply Brandon. Where would I place that "example" code you provided? In the registration template? I did check that template before I posted and you are right no easy way to insert the placeholder.

Thanks

  • 10 months later...
Posted (edited)

Brandon,

I have just upgraded my test install to 4.5.4 and the above core > global > forms > text you gave me the template is no longer there in 4.5.4? Can you please tell me where I can find the template to insert the placeholder code in?

Thanks again!

Edited by Genestoy
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...