Assign id attribute to form checkbox element

Posted 11 months ago by JokersMild85

I'm trying to assign an id attribute to checkbox elements of my form. What I am writing is causing the checkboxes to be checked by default and not providing an id attribute. Can anyone provide some insight?

Here is the code:

@foreach($exercise_type->exercises as $exercise)

    {!! Form::label('exercise_name', $exercise->exercise_name) !!}
    {!! Form::checkbox( 'exercise[]', "{$exercise->id},{$exercise->exercise_type_id},{$exercise->exercise_name}"), ['id' => "{$exercise->exercise_name}"] !!}
    </br>

@endforeach

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.