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

atorscho's avatar

Some form fields are ignored

Hello,

For a couple hours I am trying to resolve a very big and strange problem.

I have a form for Projects resource. Create and Edit views include _form.blade.php view which contains every fields. Normally, no problem here.

I have several fields in my form: client_id, type_id, title, slug, description, etc. The error is that the fields description, meta_description and the new ones that I add just to test are completely ignored. There fields are not even included in the $request->all() array, except for the description, which is present but always empty.

I really have no idea what I did to have such a problem. I have two other resources where I use same technique, and there is absolutely no problem!

Has someone already encountered this kind of issue? I am really lost in this.

Thanks in advance.

0 likes
5 replies
atorscho's avatar

@taijuten , it's not the mass assignment issue. Since it's the Request that ignores these fields, not the model, I just don't get to that line.

Yes, of course, but it's quite long:

<div class="ui segment zero top margin">
    <h3 class="ui dividing header">
        Main Information
    </h3>

    <div class="two fields">
        <div class="field">
            <label for="type_id">
                Type
                <span class="input helper"><i class="help circle icon"></i></span>
                <span class="ui popup">
                    If the needed type is not listed in the select box, you may <a href="{{ route('admin.projects.types.create') }}">add a new one</a>.
                </span>
            </label>
            {!! select('type_id', $types) !!}
        </div>
        <div class="field">
            <label for="client_id">
                Client
                <span class="input helper"><i class="help circle icon"></i></span>
                <span class="ui popup">
                    If the needed client is not listed in the select box, you may <a href="{{ route('admin.clients.create') }}">add a new one</a>.
                </span>
            </label>
            {!! select('client_id', $clients) !!}
        </div>
    </div>

    <div class="two fields">
        <div class="field">
            {!! label('title') !!}
            <div class="ui corner labeled input">
                {!! text('title', null, null, ['data-slug' => 'slug']) !!}
                <div class="ui corner label">
                    <i class="asterisk icon"></i>
                </div>
            </div>
        </div>

        <div class="field">
            {!! label('slug') !!}
            {!! text('slug') !!}
        </div>
    </div>

    <div class="field">
        {!! label('description') !!}
        {!! textarea('description', null, null, ['class' => 'editor']) !!}
    </div>

    <div class="field">
        {!! label('body') !!}
        {!! textarea('body') !!}
    </div>

    <div class="field">
        {!! label('published_at', 'Date') !!}
        {!! form_date('published_at', isset($project->published_at) ? $project->published_at : null) !!}
    </div>
</div>

<div class="ui segment zero top margin">
    <h3 class="ui dividing header">
        Details
    </h3>

    <div class="field">
        {!! label('url', 'URL') !!}
        {!! form_url('url', null, 'URL') !!}
    </div>

    <div class="two fields">
        <div class="field">
            {!! label('languages') !!}
            {!! select('languages[]', $languages, true) !!}
        </div>
        <div class="field">
            {!! label('technologies') !!}
            {!! select('technologies[]', $technologies, true) !!}
        </div>
    </div>

    @if(isset($project))
        <a class="ui fluid button" href="{{ route('admin.projects.images', $project->id) }}">
            Images
        </a>
    @endif

    <div class="field">
        <input type="text" placeholder="new field" />
    </div>
</div>

<div class="ui segment zero top margin">
    <h3 class="ui dividing header">
        SEO Meta Tags
    </h3>

    <div class="field">
        {!! label('meta_title') !!}
        {!! text('meta_title') !!}
    </div>

    <div class="field">
        {!! label('meta_description') !!}
        {!! textarea('meta_description') !!}
    </div>
</div>

@include('partials._form_controls')
taijuten's avatar

I see you're using illuminate/html for creating your forms.

If you do inspect element on the rendered page, can you see the inputs successfully created as plain html, with the correct names etc?

I also don't see the form open / close in this code, but I assume it's dealt with elsewhere?

atorscho's avatar

laravelcollective for forms.

Yes, it's exactly how it should. Each my forms are of this format, but only this one is bugging.

It is in the created.blade.php view.

atorscho's avatar
atorscho
OP
Best Answer
Level 15

Resolved! I can believe how stupid this was. It's just my helper function for forms textarea() returned always <textarea name="description" no mather the name.

Thanks anyway for trying to help me!

Please or to participate in this conversation.