Skip to main content
Dependent fields are created by invoking the dependsOn method when defining a field. The dependsOn method accepts an array of dependent field attributes and a closure that modifies the configuration of the current field instance. Dependent fields allow advanced customization, such as toggling read-only mode, validation rules, and more based on the state of another field:
To define dependent fields separately for creating and updating resources, you may use the dependsOnCreating and dependsOnUpdating methods.

Supported Dependent Fields

The following field types may depend on other fields:
  • Audio
  • BelongsTo
  • Boolean
  • BooleanGroup
  • Color
  • Code
  • Country
  • Currency
  • Date
  • DateTime
  • File
  • Heading
  • Hidden
  • Image
  • KeyValue
  • Markdown
  • MorphTo
  • Number
  • Password
  • PasswordConfirmation
  • Select
  • Status
  • Textarea
  • Text
  • Timezone
  • Trix
  • URL
  • VaporAudio
  • VaporFile
  • VaporImage
The following field types may not be depended upon by other fields since they do not live-report their changes to Nova:
  • Audio
  • Code
  • File
  • Image
  • KeyValue
  • Status
  • Tag
  • Trix
  • VaporAudio
  • VaporFile
  • VaporImage

Toggling Field Visibility Using dependsOn

One common use-case for dependent fields is toggling field visibility based on the value of another field. You can accomplish this using the hide and show methods:

Setting a Field’s Value Using dependsOn

Another common use-case for dependent fields is to set the value of a field based on the value of another field. You can accomplish this using the setValue method:

Accessing Request Resource IDs

When interacting with dependent fields, you may retrieve the current resource and related resource IDs via the resource method: