omrakhur
omrakhur

Reputation: 1402

How to correctly use Twitter Bootstrap Form Wizard with Laravel 5 blade forms?

The Twitter Bootstrap Form Wizard requires a <form class="form-horizontal mt-sm" action='' method="POST">for every tab.

I have changed it into {{ Form::open(['route' => 'myroute', 'class' => 'form-horizontal mt-sm']) }}

Do I need to do a {{ Form::close() }} for each of these? Since there's only one submit button at the end, what would be the right way to go about this then? Just one form closing? Or one for each opening?

Upvotes: 1

Views: 593

Answers (3)

omrakhur
omrakhur

Reputation: 1402

I tried both answers above, but then a hybrid version worked for me, whereby I had multiple {{ Form:: open() }} but only one {{ Form::close() }}. There was only one {{ Form::submit() }} before the form closure.

Upvotes: 0

Robin Dirksen
Robin Dirksen

Reputation: 3422

If you have only one submit button, you need to open it only once, so your code will be:

{!! Form::open(['class' => 'form-horizontal']) !!}
    <div class="mt-sm">
        <input type="text" name="item1">
    </div>
    <div class="mt-sm">
        <input type="text" name="item2">
    </div>
    {!! Form::submit() !!}
{!! Form::close() !!}

Hope this works!

Upvotes: 2

Alexey Mezenin
Alexey Mezenin

Reputation: 163898

You need to use {!! Form::close() !!} closing clause for each opening one:

{!! Form::open() !!}
{!! Form::model() !!}

Upvotes: 1

Related Questions