Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Emdel's avatar
Level 2

Laravel Collective - Wrap a form inside a div

Hi folks,

I have problems with Form facade from the Laravel Collective : I'm trying to put a form inside div (a Bootstrap well), but it's badly displayed :

Screenshot

Here is view code :

<div class="well">
        {{ Form::open(['url' => '', 'method' => 'post']) }}
        <legend>Legend</legend>
        <div class="form-group">
            {{ Form::label('email', 'Email', ['class' => 'col-lg-2 control-label']) }}
            <div class="col-lg-10">
                {{ Form::text('email', null, ['class' => 'form-control', 'placeholder' => 'Email']) }}
            </div>
        </div>
        <div class="form-group">
            {{ Form::label('password', 'Mot de passe', ['class' => 'col-lg-2 control-label']) }}
            <div class="col-lg-10">
                {{ Form::password('password', ['class' => 'form-control', 'placeholder' => 'Mot de passe']) }}
                <div class="checkbox">
                    <label>
                        {{ Form::checkbox('remember') }} Se souvenir de moi
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            {{ Form::label('comment', 'Commentaire', ['class' => 'col-lg-2 control-label']) }}
            <div class="col-lg-10">
                {{ Form::textarea('comment', null, ['rows' => 3, 'class' => 'form-control', 'placeholder' => 'Commentaire']) }}
                <span class="help-block">Donnez-nous votre avis !</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg-2 control-label">Newsletter</label>
            <div class="col-lg-10">
                <div class="radio">
                    <label>
                        {{ Form::radio('newsletter', 'yes', true) }} Oui, je souhaite recevoir la newsletter.
                    </label>
                </div>
                <div class="radio">
                    <label>
                        {{ Form::radio('newsletter', 'no') }} Non, cela ne m'intéresse pas.
                    </label>
                </div>

            </div>
        </div>
        <div class="form-group">
            <label for="select" class="col-lg-2 control-label">Selects</label>
            <div class="col-lg-10">
                {{ Form::select('size', [1, 2, 3, 4, 5, 6, 7, 8, 9], null, ['class' => 'form-control']) }}
                <br>
                {{ Form::select('size', [1, 2, 3, 4, 5, 6, 7, 8, 9], null, ['class' => 'form-control', 'multiple']) }}
            </div>
        </div>
        <div class="form-group">
            <div class="col-lg-10 col-lg-offset-2">
                <button type="reset" class="btn btn-default">Cancel</button>
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
        </div>
        {{ Form::close() }}
    </div>

Does anyone knows something about that or do you thing I should go back to regular forms ?

Greetings and thanks !

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

The Form:: element needs to mention the bootstrap class for the type of form you want.

Emdel's avatar
Level 2

I tried this once, using a :

{{ Form::open(['url' => '', 'class' => 'well']) }}

But the result still remains the same.

EDIT : I actually got this one. I forgot the tag, which is mandatory for the well displaying, if the class if specified in the Form::open() method.

Thanks a lot !

Please or to participate in this conversation.