Support the ongoing development of Laravel.io →
Requests Input Forms
Last updated 2 years ago.
0
Solution

If you want to use url attribute in form configuration you should pass url of the route not the name.

Form::open(

    array(
        'url' => '/search/results',
        'method' => 'GET',
        'class'  => 'form form-table',
     ))

If you want to pass a named route you should use 'route' param (not url):

Form::open(

    array(
        'route' => 'search-results',
        'method' => 'GET',
        'class'  => 'form form-table',
     ))

Or you can pass action using 'action param.

Take a look at: http://laravel.com/docs/4.2/html#opening-a-form

Last updated 9 years ago.
0

Thanks for the quick feedback! I've tried both routes now but both still pass the results pack to the same page and not whats in the url or route.

Could it be an issue with my route?

Route::get('/search/results',['uses' => 'SearchController@results','as' => 'search-results']);
0

If you can reach that route manually it's working.

Do you output Form::open using {!! or using {{ . Your form is closed properly? (using Form::close())

Check on your browser if html related to form is correct.

0

I'm using {{! to open and close and its working 100%.

If I visit /search/results i can get to the page and if I run the form on that page the q param is passed to the URL perfectly (/search/results?q=test) and the results are filtered. So the form is working perfectly as is all functionality technically - but only from on the route itself.

If I do the same thing from / i run the search and it passes the q param to /?q=test but obv no results are shown.

Im baffled.

0

If you don't specify any action for the form, it will be submitted to the same page (in html, php or blade page). So if something is wrong with form opening you could have the exact behaviour you are describing.

On your browser check your html and be sure that form is exactly as you expect.

0

Thanks so much - turns out my blade templates were 100% correct but somewhere in the HTML was another <form> element that was screwing it up.. thanks for the advice and sending me down the right path!!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

stankobrin stankobrin Joined 20 Mar 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.