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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

modify <input> value="" attribute for search form

Go to End

3 Posts   1784 Views


Community Member, 7 Posts

24 March 2011 at 1:58am


I want to modify the <input value=""> for the search to display a "search now" message. But I don't know where should I do this.
Any word of advice?



Community Member, 126 Posts

24 March 2011 at 6:51am

i don't like forms being generated by code, so usually i just build the html on my own.

so instead of using $SearchForm in your template, you could place the following there:

<form enctype="application/x-www-form-urlencoded" method="get" action="/sip_wagner/home/SearchForm" id="SearchForm_SearchForm">
			<div class="field text  nolabel" id="Search"><div class="middleColumn"><input type="text" value="herr" name="Search" id="SearchForm_SearchForm_Search" class="text nolabel"></div></div>
			<input type="hidden" value="de_AT" name="locale" id="SearchForm_SearchForm_locale" class="hidden">
			<input type="submit" title="Go" value="Search Now" name="action_results" id="SearchForm_SearchForm_action_results" class="action ">

that's exactly the output of $SearchForm (have a look at the html $SearchForm generates by viewing the sourcecode of your page), only thing i modified is the button value, as you requested.

some might argue that this should be done modifying the code to generate the form itself, which you could do by extending the SearchForm class, just post back if you need any help there.


Community Member, 7 Posts

24 March 2011 at 8:47pm

Yes, is working perfectly!
I don't know why I've neglected viewing the page source :)

Thank you for the hints