formers/former

error when have id key in the options list of select field

vuthaihoc opened this issue · 1 comments

When my option have an item with key "id", it make label error
My config country.list

[
  'id' => 'Indonesia',
  'br' => 'Brazil',
  'mx' => 'Mexico',
  'my' => 'Malaysia',
  'vi' => 'Vietnam',
]
Former::select('filter_country')->options(config('country.list'));

The result
screen shot 2017-07-01 at 17 18 27
Html result

<div class="mb-2 mr-sm-2 mb-sm-0">
  <label for="<option value=" id"="">Indonesia" class="sr-only"&gt;Filter country</label>
  <select class="form-control" id="filter_country" name="filter_country">
    <option value="id">Indonesia</option>
    <option value="br">Brazil</option>
    <option value="mx">Mexico</option>
    <option value="my">Malaysia</option>
    <option value="vi">Vietnam</option>
  </select>
</div>

I found a trick way to fix it

Former::select('filter_country')->options(config('country.list'))->id('filter_country')

But i don't know how to fix it from inner Former's code 😄

claar commented

Good catch -- I think this will simply remain as a "gotcha" for now. Thanks for this issue and for providing the work-around!