lundi 25 janvier 2016

Laravel checkbox inside form won't check

I'm stuck in Laravel 5.2 trying to be able to interact with a checkbox inside a form. When I click them, they just light up, but won't get checked. It seems that when I remove the form tags (or blade tags), the checkboxes can be checked, but I need them to be inside a form to submit if checked or not... code is located in home.blade.php in the @section('content') This seems to work:

@foreach($items as $item)
        <li>
                <input id="item" name="id" onClick="this.form.submit" type="checkbox" value="{{ $item->id }}" {{ $item->done ? 'checked' : ''}} />
                {{ $item->name }}
        </li>
@endforeach

But it fails here:

@foreach($items as $item)
        <li>
            {{Form::open()}}
                <input id="item" name="id" onClick="this.form.submit" type="checkbox" value="{{ $item->id }}" {{ $item->done ? 'checked' : ''}} />
                {{ $item->name }}
            {{Form::close()}}
        </li>
@endforeach

Thanks for helping!




Aucun commentaire:

Enregistrer un commentaire