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.
How do I put initial text in the search box?
ercatli
✭
I am adapting a theme and I want to put some initial text in the search box - something like "Search this forum". If I was writing an HTML form, I would just include value="Search this forum" and that should work.
But when I look at the default.master.php file, the form code is written in php, and I don't know how to do the equivalent of the value statement. I would have thought the code: $Form->TextBox('Search'), would have been the place, but it seems not.
Can anyone help this php-challenged Vanilla user do this please? Thanks.
But when I look at the default.master.php file, the form code is written in php, and I don't know how to do the equivalent of the value statement. I would have thought the code: $Form->TextBox('Search'), would have been the place, but it seems not.
Can anyone help this php-challenged Vanilla user do this please? Thanks.
Tagged:
0
Best Answer
-
zodiacdm ✭Hmmm
This could probably be done rather easily with javascript, though I am still learning myself, though, it so I can't give you an example of code.
Here is something you may find interesting, though; a jquery plugin for form defaults.
http://www.jason-palmer.com/2008/08/jquery-plugin-form-field-default-value/
0
Answers
There was an error rendering this rich post.
type="text" value="search for sth..."
I'm sorry, but I can't see how to do this - everything I tried didn't work. I presume this is the section of code in default.master.php:
<?php
$Form = Gdn::Factory('Form');
$Form->InputPrefix = '';
echo
$Form->Open(array('action' => Url('/search'), 'method' => 'get')),
$Form->TextBox('Search'),
$Form->Button('Go', array('Name' => '')),
$Form->Close();
?>
And I also presume the place where this code would go would be $Form->TextBox('Search'), but I can't make anything there work. Can you please help a struggling old man?
This could probably be done rather easily with javascript, though I am still learning myself, though, it so I can't give you an example of code.
Here is something you may find interesting, though; a jquery plugin for form defaults.
http://www.jason-palmer.com/2008/08/jquery-plugin-form-field-default-value/