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

Cascading Select and Multi-Select Options Reset After Validation Error #5874

Open
mr-mr7 opened this issue Dec 11, 2024 · 0 comments
Open

Cascading Select and Multi-Select Options Reset After Validation Error #5874

mr-mr7 opened this issue Dec 11, 2024 · 0 comments

Comments

@mr-mr7
Copy link

mr-mr7 commented Dec 11, 2024

  • Laravel Version: 11.x
  • PHP Version: 8.2
  • Laravel-admin: latest

Description:

I have a Cascading Select in my form. When the products are changed, it loads the variants, and I select a few of them. However, when the form is submitted and there is a validation error, all the options for the multi-select (related to variants) are cleared.

Could you please help me with this issue?

$productSelector = $form
            ->select('product_id')
            ->options(Product::query()->pluck('title', 'id'))
            ->load('variantsId', route('api.variants.index', ['model' => 'product']))
            ->required();

$multiSelect = $form->multipleSelect('variantsId');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant