I have two drop down fields in the admin and I want one's values to change corresponding to the selection in the other one. What can I do? I would like to avoid AJAX calls.
Here is some sample code so that you can have a basic idea:
$menus = DataObject::get( 'BassMenu' );
if( $menus ) {
$fields->addFieldToTab( 'Root.Content.Main',
new DropdownField( 'BrowseMenuID', 'Select Browse Menu',
$menus->toDropDownMap( 'ID', 'Name' ), '', null, '' ),
'Content' );
}
$subMenuCategories = DataObject::get( 'BassMenuItem', 'ParentMenuID = '.$this->BrowseMenu()->ID );
$fields->addFieldToTab( 'Root.Content.Main',
new DropdownField( 'SubMenuID', 'Select under which sub-menu this page and sub-pages should show',
$subMenuCategories->toDropDownMap( 'ID', 'Title' )
) );