Skip to content

DependsOn stops fillUsing working #4005

@anthony-brindley

Description

@anthony-brindley
  • Laravel Version: 9.8.1
  • Nova Version: 4.2.1

Description:

When you have a fillUsing method and a dependsOn method on the same field, the fillUsing doesn't populate an attribute of the model. Removing the dependsOn fixes the issue.

Detailed steps to reproduce the issue on a fresh Nova installation:

  • Create a Model with a resource.
  • Add a 2 Text Fields
  • On the 2nd field add a fillUsing method. In my example I have simply dd'd something to demonstrate the method is being run
  • On the 2nd field add a dependsOn method. In my example I have made the field readonly if the 1st field equals 0;
  • try submitting the form
  • with both the dependsOn and fillUsing, the form will submit and bypass the fill using.
  • remove the dependsOn
  • try submitting the form
  • the network tab will show the dd worked demonstrating that the fillUsing method was called

Screenshot of my code: https://www.dropbox.com/s/z90i1xju2pwwefy/phpstorm64_2022-04-15_10-46-07.png?dl=0

Video: https://www.dropbox.com/s/ufx4w4yjv17lyl0/chrome_2022-04-15_10-48-53.mp4?dl=0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions