I am using Laravel 5.2 and trying to submit a form on dropdown selection. Even though i can do it. But it always redirect to store function which is registered as a resource route.
My routes.php file have routes define like this:
Route::group(['middleware' => ['web']], function () {
Route::group(['middleware' => 'auth'], function () {
Route::get('dashboard', function () {
return view('dashboard.dashboard');
});
Route::get('getcurrency', 'QuoteController@getCurrency'); <!--------This is where i have problem--------->
Route::resource('quotes','QuoteController');
});
});
I tried naming route as well. But it always take me towards the store function
here is how my dropdown looks like:
<form method="post" action={{ action('QuoteController@getCurrency') }}>
<div class="form-group">
<label class="control-label col-md-1">Name</label>
<div class="col-md-5">
<select class="form-control select2me selectCurrency" name="user_id" onchange="this.form.submit()">
@foreach($users as $user)
<option value="{{$user->id}}">{{ $user->name }}
@if(!empty($user->companyname))
({{$user->companyname }})
@else
({{$user->email}})
@endif
</option>
@endforeach
</select>
</div>
</div>
</form>
I am not able to understand why its always force send the value to store function only, when i have even try to mentioned route, method, url and action. Non of the system working for me.
Is laravel have predefined tendency to take SUBMIT BUTTON to a specific function only?
Here is what my URL is when i have my form :
http://localhost/laravel/public/quotes
Does anyone know why this happens? And how can i fix it?
Thank you!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire