laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

[bugfix] event.value is not evaluated when the value is array

Open junamai2000 opened this issue 11 months ago • 0 comments

The conditional form generator is not work properly when IN operator is used.

        $form->select('some_type'))
            ->rules('required')
            ->options([1, 2, 3, 4, 5])
            ->when('in', [
                1,
                2,
            ], function (Form $form) {
                $form->hasMany('xxxx', 'yyyyyy', function (Form\NestedForm $nested_form) use ($form) {
                    // do something
                })->useTable();
            });

In this case above, cascade_groups is generated like this.

var cascade_groups = [{"class":"cascade-type-312d32","operator":"in","value":["1","2"]}];

and hide class is not removed correctly because the value is not expect array.

if(default_value == event.value) {

junamai2000 avatar Mar 11 '24 02:03 junamai2000