Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[solved] Add placeholder text into search box


Reply

15 Posts   4013 Views

Avatar
mierla

3 October 2013 at 2:27am Community Member, 16 Posts

@mdowton (or anyone else) - in 3*, any idea how you'd go about it with the

TextField::create("Address", "Street Address")

style construction?

Avatar
martimiz

3 October 2013 at 4:14am (Last edited: 3 October 2013 4:14am), Forum Moderator, 1095 Posts

TextField::create("Address", "Street Address")
   ->setAttribute('placeholder', 'Enter your address')

Avatar
mierla

3 October 2013 at 4:39am Community Member, 16 Posts

Thanks martimiz - that worked perfectly!

Avatar
Bennett

25 February 2014 at 11:51am Community Member, 2 Posts

Is it possible to set the placeholder text in the template rather than in the PHP code?

Avatar
novaweb

25 February 2014 at 11:55am Community Member, 115 Posts

There is probably a way, but why would you need to do this? I am sure the php option is the conventional solution.

Best,

NovaWeb

Avatar
Kzqai

18 April 2014 at 3:32am Community Member, 1 Post

Hey @mdowtown That worked for adding placeholders on the admin side as well, thanks much!

Avatar
kevinstripe

29 May 2014 at 5:02pm (Last edited: 29 May 2014 8:05pm), Community Member, 10 Posts

I agree with corry . it can also be enabled like his site.