Closed pllealfunes closed 2 years ago
Hi @pllealfunes -
Instead of addingselected
to the value, add it as another attribute in the element.
Here's a simplified example:
<select>
<option value='a' {{ old('categories') == 'A' ? 'selected' : '' }}>A</a>
<option value='b' {{ old('categories') == 'B' ? 'selected' : '' }}>B</a>
<option value='c' {{ old('categories') == 'C' ? 'selected' : '' }}>C</a>
</select>
It's similar to our checkbox example, except instead of adding checked
we're adding selected
.
Let me know if you have any issues getting that working!
@susanBuck It worked.Thank you!
Hi guys,
I was wondering if anyone knew how I can get old form data for a select input? I have tried the below and no luck. It keeps going back to my default value. Thanks!
Helper in select input
Helper in each option