Skip to content
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

Display logic does not work if dispatcher is SearchableDropdownField #158

Open
sig-peggy opened this issue Nov 14, 2024 · 0 comments
Open

Comments

@sig-peggy
Copy link

The new SearchableDropdownField introduced in Silverstripe 5.2.0 does not work as the dispatcher for display logic. As 5.2.0 also uses this new field for auto scaffolding this change may break previously functional forms.

Example code

public function getCMSFields()
{
    $fields = parent::getCMSFields();
    $fields->addFieldsToTab('Root.Main', [
        SearchableDropdownField::create('Dispatcher', 'Select to show additional field', Page::get()),
        $testField = TextField::create('Hidden', 'Conditionally visible field')
    ]);
    $testField->displayIf('Dispatcher')->isNotEmpty();
    return $fields;
}

Changing the 'Dispatcher' selection will not reveal the 'Hidden' field in this example. Equally, if using displayUnless or hideIf, the 'Hidden' field would never be hidden. Using a DropdownField instead of a SearchableDropdownField works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant