How to correctly get back old radio button values in Laravel 5? Because Using old('radiobutton1'); returns a string that contains "on", which in first fail is correct and returns for the correct button, but if you select the second radio button (in this scenario there is only two options) it will return "on" string for both old('radiobutton1') and old('radiobutton2')
Code Example:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary @if(old('radiobutton1') == "on") active @endif">
<input type="radio" name="radiobutton1" id="radiobutton1" @if(old('radiobutton1') == "on") checked @endif autocomplete="off"> Option1
</label>
<label class="btn btn-primary @if(old('radiobutton2') == "on") active @endif">
<input type="radio" name="radiobutton2" id="radiobutton2" @if(old('radiobutton2') == "on") checked @endif autocomplete="off"> Option2
</label>
</div>
P.S.
Radio buttons are styled with Twitter Bootstraps's JavaScript Radio buttons, if that matter.
I think you should use Form Facade.
It handles default value and preserves old value.
{!! Form ::radio('name', 'value', true)!!}