Support the ongoing development of Laravel.io →
Input Session Forms

Hello,

I have a get method search form with a field like this:

<form action="/search" id="searchForm" class="search-form">
    {{  Form::text("name", null, array('class' => 'form-control'))  }}

My controller look like this:

public function index()
{
    $result= $this->repo->search($data, $page, $perPage);
    return View::make('index', compact('result'));
}

And the route

Route::get('/search', 'controller@index');

I want to repopulate the form after submit.

To do this I added to my controller before the view::make:

Input::flash();

I have problems with this flashing, because when I open one of my result line from the search for editing, the old input is not empty and cause false values on the form model binding of this editing page.

How can I repopulate the search form in an other way ? (No model binding possible for the search form)

Last updated 3 years ago.
0

Hello Elyahou, I have the exact same issue at this moment in my project, I see you have posted this 8 months ago. although no one answered to you, you should already solved the problem.

Can you please let me know how you did it?

Thanks for your time and help.

Regards,

Last updated 3 years ago.
0

Hi Elyahou,

I'm not sure if I understand 100% correctly, but perhaps it helps if you put in

{{  Form::text("name", Input::old('name'), array('class' => 'form-control'))  }}

instead of using null as the value?

Or instead of your own html form, you use Form Model Binding?

{{ Form::model(...) }}

see http://laravel.com/docs/4.2/html#form-model-binding

(though be careful, I heard Form stuff is not in the core of Laravel 5)

I hope this helps.

Oliver

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Elyahou elyahou Joined 7 Mar 2014

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.

© 2025 Laravel.io - All rights reserved.