Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeater won't send values to database when 2 or more fields are inside the repeater.(i've to use same name as the input's name but how can i name them when 2 or more fields are there?) #12640

Closed
isubarnaL opened this issue May 5, 2024 · 4 comments
Labels
bug Something isn't working low priority unconfirmed
Milestone

Comments

@isubarnaL
Copy link

isubarnaL commented May 5, 2024

Package

filament/forms

Package Version

v3.2

Laravel Version

v11

Livewire Version

No response

PHP Version

PHP 8.2.12

Problem description

this is my resource code


                Repeater::make('tripplans')
                ->schema([
                    TextInput::make('triptitle')
                    ->required(),
                    TextInput::make('tripdesc')
                    ->required(),
                ])
                ->addActionLabel('Add Another Day')
                ->columns(2)
                ->columnSpan(2),
               

if i just make the name of repeater triptitle/tripdesc it will send the data of that named field and won't send input data of other field

Expected behavior

i wanted it to just work normally and the values to be stored as json in db.

Steps to reproduce

using repeater multiple times is not working.

Reproduction repository

https://github.com/isubarnaL/travel

Relevant log output

No response

@isubarnaL isubarnaL added bug Something isn't working low priority unconfirmed labels May 5, 2024
@danharrin danharrin added this to the v3 milestone May 6, 2024
@isubarnaL isubarnaL changed the title repeater triptitle and tripdesc won't send values to database. (Field 'triptitle' doesn't have a default value in this form but i've casts as json for these columns and in database too") Repeater won't send values to database when 2 or more fields are inside the repeater.(i've to use same name as the input's name but how can i name them when 2 or more fields are there?) May 11, 2024
@isubarnaL
Copy link
Author

I've found that when i change the name of the repeater to triptitle, it sends the value of triptitle input as intended but its still not sending the value of tripdesc. how can i write the name of the repeater so as to send the value of all input fields?

@efremov-ie
Copy link

efremov-ie commented May 12, 2024

@isubarnaL It should work

Repeater::make('tripplans')
    ->schema([
        TextInput::make('tripplans.triptitle')
        ->required(),
        TextInput::make('tripplans.tripdesc')
        ->required(),
    ])
    ->addActionLabel('Add Another Day')
    ->columns(2)
    ->columnSpan(2),

@isubarnaL
Copy link
Author

@efremov-ie Its not working.The same error.

1364 Field 'triptitle' doesn't have a default value

@danharrin
Copy link
Member

No public reproduction repo.

tripplans needs to be a JSON column in your database. triptitle and tripdesc should not exist. All data will be stored in one column. If you need alt behaviour, you need to modify the form data before save and fill to extract the values into the separate columns.

@danharrin danharrin closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority unconfirmed
Projects
Status: Done
Development

No branches or pull requests

3 participants