Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

adamnet's avatar

Form submission with empty fields is not stopped by validation

In my Laravel 11 application form submission with empty fields is not stopped by validation. What drives me crazy is that the same app - the same deployed code - works absolutely correctly in quite a few installations without ANY problem. If I leave empty fields I get the validation error messages and the form is not submitted. In the one problematic site, by clicking submit, the form is submitted (is it really submitted?) and the next I get is a 419 Page Expired error. I deleted all the contents of the deployed laravel code and re-transferred everything inside the app folder but the same thing happens. It is a simple form with the code below:

        <div class="col-sm">
            <div class="form-group">
                <label for="doctitle"><strong>Name</strong></label>
                <input type="text" class="form-control" id="doctitle" name="doctitle" value="{{ old('doctitle', $doc->doctitle ?? '') }}"  placeholder="Please enter your name">
                @error('doctitle')
                <span class="text-danger">{{$message}}</span>
                @enderror
            </div>
        </div>
      <div class="d-grid gap-2 d-md-flex">
        <button type="submit" name="action" value="saveandclose" class="btn mt-3 mb-5 btn-outline-primary">Submit</button>
    </div>

      <br>

    </form>
0 likes
4 replies
Glukinho's avatar

419 Page Expired error

It means you forgot to add @csrf to your form.

Also, show full code of the form and validation code (FormRequest?) which doesn't work.

jlrdw's avatar

@ghabe very hard to see what is going on without seeing more code. But OP says it works on another site as is meaning the same code.

adamnet's avatar

Thanks for your interest. Finally the problem was solved. It was a security matter with the host server.

Please or to participate in this conversation.