2 years ago

Disabling submit buttons. What shall I return?

Posted 2 years ago by P-Torres

I get "Missing return statement" (PHPStorm).

I have a form with two submit buttons "Update & Reload" and "Update"

The following works (in edit form):

<div class="btn-group" role="group" aria-label="">
    <button type="submit" class="btn btn-info" name="update-and-reload" value ="update-and-reload">
        Update & Reload
    <button type="submit" class="btn btn-primary" name="update" value="update">

My Controller

public function update(ArticleRequest $request, $id)
        ... some code...

        if (Input::get('update-and-reload')) {


            return back();

        } else if (Input::get('update')) {


            return redirect()->route('articles.index');



But, when implementing the following to disable the buttons once clicked, it fails...

After submitting I get a blank page!

        $('form').submit(function (event) {
            $(this).find(':submit').attr("disabled", true));

Any suggestions are appreciated. Thank you.

Please sign in or create an account to participate in this conversation.