简体   繁体   中英

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?

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!

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM