Combobox with yes and no on the Laravel

Asked

Viewed 182 times

1

I have a combobox that has the values yes and no. He is bringing the value not put in the bank but the edit form does not appear the other option that in the case would be yes. How do I make the opposite option appear?

<select name="disponivel_venda" class="form-control">
    @foreach($properties as $value)
        <option {{$property->disponivel_venda == $value->disponivel_venda ? 'selected' : '' }}  value="{{ $value->disponivel_venda }}">{{$value->disponivel_venda}}</option>
    @endforeach
</select>
  • How it’s being recorded?

  • 1

    <select name="available_sale" class="form-control"> <option Selected="disabled">Select</option> <option value="Yes">Yes</option> <option value="No">No</option> </select>

  • It causes what problem?

  • I said up there in the post

  • I believe that your Send Controller would be necessary for me to see what is sending to View and it seems to me a simple adjustment since this select only has two options, I just really need to know which of the classes returns this value

1 answer

1


Basically that would be:

<select name="disponivel_venda" class="form-control">
    <option {{$property->disponivel_venda=='Sim'?' selected':''}}>Sim</option>
    <option {{$property->disponivel_venda!='Sim'?' selected':''}}>Não</option>
</select>
  • 1

    It worked, that’s exactly it, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.