jeudi 20 octobre 2016

How do I bind a radio button value to my model? Laravel 5.3

I have a form with a couple of radio buttons;

<div class="form-group col-md-6">
<label for="procurement" class="col-md-6 control-label">Procurement Type <span class="red">*</span></label><br>

<div class="col-md-12">
    <input id="procurement" type="radio" name="procurement" value="owned"> Owned
    <input id="procurement" type="radio" name="procurement" value="rental"> Rental

    @if ($errors->has('procurement'))
        <span class="help-block">
            <strong></strong>
        </span>
    @endif
</div>

I am reusing the form for editing purposes so I want to be able to bind the object's value for 'procurement' when I present the form in edit view. I am able to use this bind the values for text inputs;

value=""

But this does not work for radios or selects. What should I be doing? I am NOT using the Form facade for this.

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire