Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Genestoy Posted December 16, 2019 Posted December 16, 2019 (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> Thanks Edited December 16, 2019 by Genestoy
Genestoy Posted December 19, 2019 Author Posted December 19, 2019 (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 Edited December 19, 2019 by Genestoy
bfarber Posted December 20, 2019 Posted December 20, 2019 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.
Genestoy Posted December 20, 2019 Author Posted December 20, 2019 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
bfarber Posted December 23, 2019 Posted December 23, 2019 No, it's a very central template used by every single text input. It would be core > global > forms > text.
Genestoy Posted December 23, 2019 Author Posted December 23, 2019 Thanks again Brandon, worked perfect!
Genestoy Posted November 8, 2020 Author Posted November 8, 2020 (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 November 8, 2020 by Genestoy
Genestoy Posted November 9, 2020 Author Posted November 9, 2020 Many thanks again Brandon, I feel like an idiot, I was looking in the wrong global!
Recommended Posts