2

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?

3
  • It works for me using BTS3 and your given code in L4. Commented Oct 15, 2013 at 21:47
  • Let me do some further testing and I'll report back. Thanks for verifying that it works. Commented Oct 15, 2013 at 23:23
  • Try clearing your browser cache as well. Browsers tend to remember some strange things and don't often forget even after cache is cleared. Commented Oct 16, 2013 at 12:25

1 Answer 1

2

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.