【问题标题】:Twitter Bootstrap 3 RC1 brokes submit button?Twitter Bootstrap 3 RC1 破坏了提交按钮?
【发布时间】:2016-03-28 17:07:13
【问题描述】:

我正在使用 Laravel 4 和 Twitter Bootstrap 3 来制作一个简单的应用程序,但是在处理我的表单时遇到了一些奇怪的事情。我使用的是早期的 CSS/HTML 模板系统,提交按钮工作正常,但现在完全没有响应。我为我的表单使用了相同的 Laravel Blade 代码,所以我无法弄清楚为什么表单拒绝提交。

<div class="row">
    <div class="col-lg-6 col-lg-offset-3">
        <h1>Event Selection</h1>
        {{ Form::open(array('action' => 'TicketController@postIndex')) }}                               
            <div class="form-group">
                <select id="eventSelect" class="form-control">
                    @foreach ($events as $event)
                        <option value='{{$event->eventID}}'>{{ $event->eventName }}</option>
                    @endforeach
                </select>
            </div>
            <button type="button" id="buttonsub" class="btn btn-primary btn-lg btn-block">Continue</button>
        {{ Form::close() }}
    </div>
</div>

此处发布完整代码:https://gist.github.com/verkaufer/6ac3aaf3475cc67c3b96

这是 Laravel 4 的问题,还是我只是因为 Twitter Bootstrap 3 处于 RC 阶段而遇到了一些奇怪的事情?

【问题讨论】:

  • 我也在使用 Twitter Bootstrap 3 RC1 + Laravel 4,我对任何提交按钮都没有问题,我有大约 20 个表单。
  • 将 type 属性从 type=button 更改为 type=submit

标签: html twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

您的按钮类型是:按钮,没有提交。尝试将类型从 button 更改为 submit

你需要改变:

<button type="button" id="buttonsub" class="btn btn-primary btn-lg btn-block">Continue</button>

到这里:

<button type="submit" id="buttonsub" class="btn btn-primary btn-lg btn-block">Continue</button>

请记住,使用正确的类型属性非常重要。有时可能是出于语义原因,有时可能是出于功能原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-22
    • 2012-10-12
    • 2013-11-30
    • 1970-01-01
    • 2012-12-15
    • 1970-01-01
    • 2011-08-02
    • 2015-01-13
    相关资源
    最近更新 更多