Download the PHP package fromholdio/silverstripe-dependentgroupeddropdownfield without Composer
On this page you can find all versions of the php package fromholdio/silverstripe-dependentgroupeddropdownfield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fromholdio/silverstripe-dependentgroupeddropdownfield
More information about fromholdio/silverstripe-dependentgroupeddropdownfield
Files in fromholdio/silverstripe-dependentgroupeddropdownfield
Package silverstripe-dependentgroupeddropdownfield
Short Description A silverstripe groupeddropdown field that has it's options populated via ajax, based on the value of the field it depends on
License BSD-3-Clause
Homepage https://github.com/fromholdio/silverstripe-dependentgroupeddropdownfield
Informations about the package silverstripe-dependentgroupeddropdownfield
silverstripe-dependentgroupeddropdownfield
A SilverStripe grouped dropdown field that has its options populated via ajax, based on the value of the dropdown field it depends on.
Note - this has been changed from v4+ from a fork of Shea Dawson's silverstripe-dependentdropdownfield to an extension of it instead. That is, the DependentGroupedDropdownField in this module is a subclass of the source DependentDropdownField.
Requirements
SilverStripe 6.x
Installation
composer require fromholdio/silverstripe-dependentgroupeddropdownfield
What exactly is this?
See user guide for usage screenshots.
Usage example
First, create the DropdownField that your new field's values will be dependent on.
Note: it is not necessary for the original dropdown field to have an empty string. If it doesn't, its first value will be used to auto-load the optgroups/options into your dependent field.
Second, create a callable function that returns an array suitable for the $source parameter of GroupedDropdownField. (A two dimensional array; the first level is used for the optgroup, and the second level for the
Now, create your DependentGroupedDropdownField, setting the source as the callable function created above.
Ensure that you connect the fields:
And now you're ready to go.