Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » How to modify the search form box?

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

Page: 1
Go to End
Author Topic: 2211 Views
  • Howard
    Avatar
    Community Member
    215 Posts

    How to modify the search form box? Link to this post

    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.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: How to modify the search form box? Link to this post

    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...

    2211 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.