Jump to:

1999 Posts in 1421 Topics by 613 members

Form Questions

SilverStripe Forums » Form Questions » modify <input> value="" attribute for search form

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

Page: 1
Go to End
Author Topic: 1130 Views
  • AL
    Avatar
    Community Member
    7 Posts

    modify <input> value="" attribute for search form Link to this post

    Hi,

    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?

    Thanks

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: modify <input> value="" attribute for search form Link to this post

    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">
       <fieldset>
          <legend></legend>
          
             <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 ">
          
       </fieldset>
    </form>

    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.

  • AL
    Avatar
    Community Member
    7 Posts

    Re: modify <input> value="" attribute for search form Link to this post

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

    Thank you for the hints

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