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

[Bug] In the edit form, the relationship field does not keep its value (select). #5245

Closed
CamusMX7 opened this issue Jul 31, 2023 · 4 comments
Assignees
Labels
Possible Bug A bug that was reported but not confirmed yet.

Comments

@CamusMX7
Copy link

CamusMX7 commented Jul 31, 2023

Bug report

I have several fields as follows that recently worked correctly:

Controller

CRUD::field('cliente')->allows_null(true)->wrapper([
            'class' => 'form-group col-md-12 pl-0 pr-0',
        ]);

Model

public function cliente(): BelongsTo
    {
        return $this->belongsTo(Cliente::class);
    }

Up to this point they worked well:

backpack/basset: 1.0.0
backpack/crud: 6.0.6
backpack/generators: v4.0.1
backpack/permissionmanager: 7.0.0
backpack/pro: 2.0.8
backpack/theme-coreuiv2: 1.1.3
backpack/theme-tabler: 1.0.5

What I expected to happen

That they continue to function well

What happened

In the next update (I think 6.0.7), the form no longer showed the database field that it contains and that in the list it still shows correctly.

listado
form

What I've already tried to fix it

This is obviously not a solution but it works for the time being.

If I add ajax(true) includes the correct value:

CRUD::field('cliente')->allows_null(true)->ajax(true)->wrapper([
            'class' => 'form-group col-md-12 pl-0 pr-0',
]);

or assigned another corresponding field type, in my case I have many fields similar to the one I mentioned and adding type("select") works as before.

 CRUD::field('cliente')->allows_null(true)->type("select")->wrapper([
            'class' => 'form-group col-md-12 pl-0 pr-0',
        ]);

I have a lot of fields like that, but I can add the corresponding type to each field and have backpack not try to guess the relationship. But I think it might have been something that affected production recordings, as the value of the dependent field(s) is lost when saving.
It is a detail, but I think it has a certain impact.

Is it a bug in the latest version of Backpack?

Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

LARAVEL VERSION:

10.16.1.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.0.2
backpack/crud: 6.1.1
backpack/generators: v4.0.2
backpack/permissionmanager: 7.0.0
backpack/pro: 2.0.9
backpack/theme-coreuiv2: 1.1.4
backpack/theme-tabler: 1.0.6

@karandatwani92 karandatwani92 self-assigned this Jul 31, 2023
@pxpm pxpm assigned pxpm and unassigned karandatwani92 Jul 31, 2023
@pxpm pxpm added Possible Bug A bug that was reported but not confirmed yet. and removed triage labels Jul 31, 2023
@pxpm
Copy link
Contributor

pxpm commented Jul 31, 2023

This will be fixed in the next PRO release 2.0.10 that I will tag later today along with some other fixes.

The fix is already merged, it's just waiting for the tag.

Thanks for the report @CamusMX7 🙏

@pxpm pxpm closed this as completed Jul 31, 2023
@maulsea
Copy link

maulsea commented Aug 1, 2023

@pxpm Hello, our release is blocked on this issue. Could you let us know when do we expect 2.0.10? It looks like it is not tagged yet. Thank you!

@pxpm
Copy link
Contributor

pxpm commented Aug 1, 2023

@maulsea @CamusMX7 I've just tagged 2.0.10. It should take a few time for our private repository to pick the release and then you can get it with a composer update.

Cheers

@tabacitu
Copy link
Member

tabacitu commented Aug 1, 2023

I just ran a repo build. We have 2.0.10 so you can update to it and use it @maulsea - https://repo.backpackforlaravel.com/#backpack%2Fpro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Possible Bug A bug that was reported but not confirmed yet.
Projects
Status: Done
Development

No branches or pull requests

5 participants