Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Form on any page that submits to standard results page

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

Page: 1
Go to End
Author Topic: 825 Views
  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Form on any page that submits to standard results page Link to this post

    I have followed http://doc.silverstripe.org/recipes:dataobjectsearch

    and while this works on my page of type "house" which holds and displays the results

    For Example
    I go to this page and "all houses" are listed and you can submit the form to filter.

    Question: What would i need to do to have 'Only" the form on any givenpage.

    For example I made the form appear on my homepage.ss by including $HouseSearchForm great

    but the form submits to home/HouseSearchForm and doesn't show any results.

    Note: On the homepage i don't want a default listing of houses to appear. I just want the form and when its submitted it would go to a result page

    should i be altering the doserach() fuction

    return new Form($this, 'HouseSearchForm', $fields, $actions);

  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: Form on any page that submits to standard results page Link to this post

    Hmmm,

    There might be a better solution but,

    What you could do is build the form in the template manually as described here:
    http://doc.silverstripe.org/form#using_a_custom_template

    Then you could set the action of the form to go wherever you want.

    It's not ideal, but it is a solution.

  • e-scape
    Avatar
    Community Member
    16 Posts

    Re: Form on any page that submits to standard results page Link to this post

    I had to sort out a very similar problem this afternoon.
    You should look at the 'setFormAction' method on the Form class.
    Worked a treat for me.

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