【问题标题】:laravel form is not submittinglaravel 表单未提交
【发布时间】:2014-08-07 10:54:50
【问题描述】:

这是我的代码

{{ Form::open(array('route' => 'restaurants.store', 'id' => 'msform')) }}
<!-- multistep form -->

        <!-- progressbar -->
        <ul id="progressbar">
            <li class="active">Account Setup</li>
            <li>Social Profiles</li>
            <li>Personal Details</li>
            <li>Address</li>
        </ul>
        <!-- fieldsets -->
        <fieldset>
            <h2 class="fs-title">Create your account</h2>
            <h3 class="fs-subtitle">This is step 1</h3>
            {{ Form::text('email', '', array('placeholder' => 'Username'))}}
            {{ Form::password('password', array('placeholder' => 'Password'))}}
            {{ Form::password('confirmPassword', array('placeholder' => 'Confirm Password'))}}
            {{ Form::button('next', array('class' => 'next action-button'))}}
        </fieldset>
        <fieldset>
            <h2 class="fs-title">General Information</h2>
            <h3 class="fs-subtitle">Your public profile</h3>
            <input type="text" name="restaurantName" placeholder="Restaurant Name" />
            <input type="text" name="phoneNumber" placeholder="Phone Number" />
            <input type="text" name="website" placeholder="Website" />
            <input type="button" name="previous" class="previous action-button" value="Previous" />
            <input type="button" name="next" class="next action-button" value="Next" />
        </fieldset>
        <fieldset>
            <h2 class="fs-title">Personal Details</h2>
            <h3 class="fs-subtitle">We will never sell it</h3>
            <input type="text" name="firstName" placeholder="First Name" />
            <input type="text" name="lastName" placeholder="Last Name" />
            <input type="text" name="mobileNumber" placeholder="Mobile Number" />
            <input type="button" name="previous" class="previous action-button" value="Previous" />
            <input type="button" name="next" class="next action-button" value="Next" />
        </fieldset>
        <fieldset>

            <script src="https://maps.googleapis.com/maps/api/js"></script>
                <div id="map_manual_address_container">
                    <div id="map_canvas"></div>
                    <div id="mamual_address">
                        <textarea name="address" placeholder="Address"></textarea>
                    </div>
                </div>

            <input type="button" name="previous" class="previous action-button" value="Previous" />
            <input type="submit" name="submit" class="submit action-button" value="Submit" />
            {{ Form::submit('submit', array('class' => 'submit action-button')) }}
        </fieldset>

{{ Form::close() }}

当我点击提交时,什么都没有发生,我的意思是当我点击按钮时,就像没有点击一样。

routes.php

Route::resource('restaurants', 'RestaurantsController');

餐厅控制器

<?php

class RestaurantsController extends BaseController {

public function store()
    {
        //
    }

}

我不知道我做错了什么希望你能帮助

【问题讨论】:

  • 您以表单操作restaurants.store 的形式传递了一个路由,但您尚未定义路由名称。
  • @zwacky 请问you haven't defined a route name 是什么意思?我已经向你展示了我的控制器中的 store 函数
  • 你试过调试这个吗? HTML 中的表单操作是什么?如果您在 store 方法中打印“hello world”会发生什么?
  • 我的错,资源自动添加路由名称,如restaurants.store
  • @fire 这是来自 chrome 调试 &lt;form method="POST" action="http://localhost:8082/ParkingProject/public/restaurants" accept-charset="UTF-8" id="msform"&gt;&lt;input name="_token" type="hidden" value="TUU8Us2X6qcvKiw8RpYSkrOA0Rui41EiLLG4XcWt"&gt;&lt;!-- multistep form --&gt;,当我回显 hello world 时,仍然没有任何反应,它喜欢它根本不会进入控制器

标签: php laravel laravel-4 blade


【解决方案1】:

我自己找到了解决方案,我是一个白痴愚蠢的程序员

我有这个功能

$(".submit").click(function () {
    return false;
})

我忘了删除它。

请原谅我的愚蠢问题

【讨论】:

    猜你喜欢
    • 2018-04-09
    • 2018-05-10
    • 2020-10-25
    • 2018-06-22
    • 2021-09-05
    • 2014-12-02
    • 1970-01-01
    • 1970-01-01
    • 2020-02-25
    相关资源
    最近更新 更多