Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 16, 20195 yr 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, 20195 yr by Genestoy
December 19, 20195 yr Author 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, 20195 yr by Genestoy
December 20, 20195 yr 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.
December 20, 20195 yr Author 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
December 23, 20195 yr No, it's a very central template used by every single text input. It would be core > global > forms > text.
November 8, 20204 yr Author 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, 20204 yr by Genestoy
November 9, 20204 yr Author Many thanks again Brandon, I feel like an idiot, I was looking in the wrong global!