kmm
kmm

Reputation: 618

Default checked radio input not working in Laravel with Bootstrap syntax

Using Laravel 4's Radio form helper, I cannot use Bootstrap 3's radio button syntax and get the inputs to be checked by default.

Here is a normal radio button setup, that works properly

{{Form::radio('awesome_radio_input', 'yes', true)}} Yes
{{Form::radio('awesome_radio_input', 'no')}} No

And here is the BS3 syntax, where I am not getting any radio inputs checked by default

<div class="radio-inline">
    <label>
        {{Form::radio('silly_radio_input', 'yes', true)}}
        Yes
    </label>
</div>
<div class="radio-inline">
    <label>
        {{Form::radio('silly_radio_input', 'no')}}
        No
    </label>
</div>

Any ideas as to why the syntax would break the Radio helper?

Upvotes: 2

Views: 3210

Answers (1)

aziz_alqudsy
aziz_alqudsy

Reputation: 23

Try this :

<div class="form-group">
    {{ Form::label('gender', 'Gender') }}
    <div class="form-inline">
        <div class="radio">
            {{ Form::radio('gender', 'true', true) }}
            {{ Form::label('men', 'Men') }}
        </div>
        <div class="radio">
            {{ Form::radio('gender', 'false') }}
            {{ Form::label('woman', 'Woman') }}
        </div>
    </div>
</div>

Upvotes: 2

Related Questions