yassilah / laravel-nova-nested-form

This package allows you to include your nested relationships' forms into a parent form.
240 stars 96 forks source link

Multilevel nested forms return validation error #85

Open coding-artists opened 5 years ago

coding-artists commented 5 years ago

Hi, I'm encountering some issue with multilevel nested forms. I get this error message:

{
    "message": "The given data was invalid.",
    "errors": {
        "modules[1][module]": ["The module field is required."]
    }
}

Here the resources fields: Course:

public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            Text::make('Name')
                ->sortable()
                ->rules('required', 'max:255'),
            BelongsTo::make('Level', 'level', 'App\Nova\Level'),
            BelongsTo::make('Category', 'category', 'App\Nova\Category'),
            HasMany::make('Modules'),
            NestedForm::make('Modules')
        ];
    }

Module:

public function fields(Request $request)
    return [
            ID::make()->sortable(),
            BelongsTo::make('Course', 'course', 'App\Nova\Course'),
            Text::make('Name')
                ->rules('required', 'max:255'),
            Textarea::make('Summary')
                ->rules('required'),
            HasMany::make('Lessons'),
            NestedForm::make('Lessons')
        ];
}

Lesson:

public function fields(Request $request)
    return [
            ID::make()->sortable(),
            Text::make('Name'),
            BelongsTo::make('Module', 'module', 'App\Nova\Module'),
            Trix::make('Content')->withFiles('public')
        ];
}
0x15f commented 5 years ago

Can confirm the same issue. This looks like it may be an issue within Laravel Nova? This package merely modifies the create/update form.

BobbyBorisov commented 5 years ago

Hey @0x15f @coding-artists, do you know the fix to that issue?

coding-artists commented 5 years ago

@BobbyBorisov I did not dive into it. I was trying Nova and it wasn't the best option for our requirements, but I opened the issue because I found interesting the approach to multilevel nested form and I just suggested the author to fix it :)

0x15f commented 4 years ago

Has anyone found a fix for this?

alberto-bottarini commented 3 years ago

Same issue for me

popovoleksandr commented 3 years ago

I can confirm the same issue with nova 3.29 and nova-nested-form v3.0.12

medina325 commented 2 years ago

yep I have the same problem, great!

ahmada3mar commented 2 years ago

@yassilah is there any Solution?