Skip to content

dependsOn is not ignoring hidden fields #4170

@williamcruzme

Description

@williamcruzme
  • Laravel Version: 9.9.0
  • Nova Version: 4.4.1
  • PHP Version: 8.0
  • Database Driver & Version: MySQL
  • Operating System and Version: MacOS 11.6
  • Browser type and version: Chrome 101.0.4951.54

Issue 1:

Having a field like:

Select::make('Merchant', 'merchant_id')
    ->options(Merchant::pluck('official_name', 'id'))
    ->displayUsingLabels()
    ->onlyOnForms()
    ->dependsOn(
        ['type'],
        function ($field, $request, $formData) {
            $field->hide();
        }
    ),

It's still including the merchant_id in the Body with a value.

image

Issue 2:

Having hidden field like:

Number::make('Amount')
    ->rules('required')
    ->dependsOn(
        ['type'],
        function ($field, $request, $formData) {
            $field->hide();
        }
    )

It's still reading the rules:
image


Those issues are new. That wasn't happening.

Metadata

Metadata

Assignees

Labels

bugVerified bug by the Nova team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions