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.

Form Questions /

How to modify the search form box?


Reply


2 Posts   2284 Views

Avatar
Howard

Community Member, 215 Posts

24 December 2008 at 2:10am

Hi guys,

I am implementing search on a site but have one small issue. The "Go" button sits below the search box and I want it to sit next to it. The current generated html looks like:

<div id="Search" class="field text nolabel">
<div class="middleColumn">
<input class="text nolabel" id="SearchForm_SearchForm_Search" name="Search" value="Search" type="text">
</div>
</div>
<input class="action" id="SearchForm_SearchForm_action_results" name="action_results" value="Go" title="Go" type="submit">

But if I use Firebug and change it to:

<div id="Search" class="field text nolabel">
<div class="middleColumn">
<input value="Search" name="Search" id="SearchForm_SearchForm_Search" class="text nolabel" type="text">
<input title="Go" value="Go" name="action_results" id="SearchForm_SearchForm_action_results" class="action" type="submit">
</div>
</div>

then its exactly what I want, I just don't know how to get it to generate it properly.

Avatar
dio5

Community Member, 501 Posts

27 December 2008 at 11:25pm

I would use CSS to position it where I want - if it's just a matter of visual positioning.

If you really need it to be next to it codewise this would require some subclassing because you're adding an 'action' in a 'field'. You would have to alter the way Silverstripe renders it default fields...

Take a look at sapphire/templates/SearchForm.ss...