Reputation: 89
i have the problem with my select. When i select option and click on submit button the selected value is lost.
{{ Form::open(['url' => route('index'), 'method' => 'GET', 'class' => 'form']) }}
{{ csrf_field() }}
<select class="form-control select2" data-tags="true" data-placeholder="Select filter" data-allow-clear="true" name="filterClients" id="filterClientBy" style="width: 100%;">
<option></option>
<option name="firstCalling" value="firstCalling" {{Request::has('firstCalling')?'selected':''}}>First callin</option>
<option name="firstVisit" value="firstVisit"{{Request::has('firstVisit')?'selected':''}}>First visit</option>
</select>
<button type="submit" id="apply" class="btn btn-success">Apply filters</button>
{{ Form::close() }}
Upvotes: 0
Views: 505
Reputation: 50326
form submit
is a kind of page refresh. Try to submit
the form using an ajax request
<form onsubmit="yourFunctionName()">
// rest of the form
</form>
function yourFunctionName(e){
event.preventDefault();
//here ajax code to submit the form value
}
Upvotes: 0
Reputation: 180
instead of <form>
use <form action="name of file or #" method="post or get ">
Upvotes: 2