I need help with saving a selected option after validation fails.
Here is main.blade.php
<form method="POST" action="">
<select id="searchEngine" name="searchEngine">
<option value="google">Google</option>
<option value="bing">Bing</option>
<option value="duckduck">DuckDuckGo</option>
</select>
@if ($errors->has('searchEngine'))
<div style="background-color: #faa;">
@foreach ($errors->all() as $error)
@endforeach
</div>
@endif
</form>
Controller looks like:
request()->validate(
['searchEngine' => "required|in:google,duckduck"],
['searchEngine.in' => $searchEngine.' not working, try another']
);
I tried this, but it always returns only the last option:
<option value="google" {!! $errors->has('searchEngine') ? 'selected' : '' !!}>Google</option>
<option value="bing" {!! $errors->has('searchEngine') ? 'selected' : '' !!}>Bing</option>
<option value="duckduck" {!! $errors->has('searchEngine') ? 'selected' : '' !!}>DuckDuckGo</option>
via Chebli Mohamed
1 commentaire:
PHP import Excel data to MySQL using PHPExcel
How to convert Excel to CSV Python Pandas
How to read data from excel file using Python Pandas
How to install NLTK for Python on Windows 64 bit
How to read data from excel file in Python
Enregistrer un commentaire