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)
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,
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community