Jump to content

Placeholder attribute?


Genestoy
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 10 months later...

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
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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