简体   繁体   English

如何正确使用Laravel 5刀片表单的Twitter Bootstrap Form Wizard?

[英]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. Twitter Bootstrap Form Wizard对每个选项卡都需要<form class="form-horizontal mt-sm" action='' method="POST">

I have changed it into {{ Form::open(['route' => 'myroute', 'class' => 'form-horizontal mt-sm']) }} 我已将其更改为{{ Form::open(['route' => 'myroute', 'class' => 'form-horizontal mt-sm']) }}

Do I need to do a {{ Form::close() }} for each of these? 我是否需要为这些中的每一个做{{ Form::close() }} 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() !!} {!! Form::close() !!} closing clause for each opening one: {!! Form::close() !!}每个开头的关闭子句:

{!! 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() }}. 我在上面尝试了两个答案,但随后混合版本为我工作,我有多个{{Form :: open()}}但只有一个{{Form :: close()}}。 There was only one {{ Form::submit() }} before the form closure. 在表单闭包之前只有一个{{Form :: submit()}}。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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