Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search box
422
MVP
I wish to add placeholder text within search box, do you know where thee code is for this plz.
There was an error rendering this rich post.
Tagged:
0
Best Answer
-
Todd Vanilla Staff
If you are using default.master.php you can transmit any html attribute in
$Form->TextBox
.echo $Form->TextBox('Search', array('placeholder' => T('Search Forums')));
If you are using the
{searchbox}
in your theme then the placeholder is just the translation of "Search". So you could add the following definition:$Definition['Search'] = 'Search Forums';
Since the word "Search" is rather generic that translation may clash with other instances of it on the site. We could be persuaded to make the translation different.
0
Answers
application\dashboard\views\default.master.php
I too want to add placeholder to it. But maybe it would be better to use some js code?
Cheers perhaps we can add value somehow. Will have a play
There was an error rendering this rich post.
Well, try this
If you are using default.master.php you can transmit any html attribute in
$Form->TextBox
.If you are using the
{searchbox}
in your theme then the placeholder is just the translation of "Search". So you could add the following definition:Since the word "Search" is rather generic that translation may clash with other instances of it on the site. We could be persuaded to make the translation different.
I was really looking to add ID but see ths is already implemented, but thanks todd. Will keep playing.
There was an error rendering this rich post.
@Todd:
I currently have this:
Can you please tell me what I have to do to get this as end-result:
Sorry, but I'm a Noob in this area.
That `placeholder="Search..." should do the exact same thing as your javascript @Reiter. If you want to add javascript to elements you never add inline events to the html, you always add jQuery.
I recommend heading over to http://jquery.com and familiarizing yourself with the library. It will help you immensely to understand this now ubiquitous library.