Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Selecting MorphTo type doesn't trigger dependsOn #6078

Closed
Aniruddh-J opened this issue Nov 30, 2023 · 1 comment
Closed

Selecting MorphTo type doesn't trigger dependsOn #6078

Aniruddh-J opened this issue Nov 30, 2023 · 1 comment
Labels
pending Issues that are pending triage

Comments

@Aniruddh-J
Copy link

  • Laravel Version: 10.34.2
  • Nova Version: 4.32.6
  • PHP Version: 8.2.13
  • Database Driver & Version: MySQL 8.1.0
  • Operating System and Version: macOS Sonoma 14.1.1
  • Browser type and version: Chome 119.0.6045.159

Description:

Selecting type in MorphTo field selection doesn't trigger dependsOn if a field is dependant on it.

$title = MorphTo::make('Title Type', 'title')
    ->types([
        Movie::class,
        Series::class,
    ])
    ->showCreateRelationButton()
    ->sortable()
    ->rules('required')
    ->searchable()
    ->help('The movie or series the quote belongs to'),

Text::make('Description')
    ->sortable()
    ->searchable()
    ->dependsOn($title, function(Text $field, NovaRequest $request, FormData $formData) {
        ray($formData->title_type); // Only triggers on load
        if ($formData->title_type != null) {
            return $field->show()->rules('required');
        } else {
            return $field->hide();
        }
    } )
    ->help('The description of the title'),
@eroctra

This comment was marked as off-topic.

@crynobone crynobone added the pending Issues that are pending triage label Feb 12, 2024
@laravel laravel locked and limited conversation to collaborators Feb 15, 2024
@crynobone crynobone converted this issue into discussion #6206 Feb 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
pending Issues that are pending triage
Projects
None yet
Development

No branches or pull requests

3 participants