newbie LAC Posted January 16, 2020 Posted January 16, 2020 Hello, $form = new \IPS\Helpers\Form(); $elements = array(); $options = array(); $toggles = array(); $unlimitedToggles = array(); $selected = -1; foreach (array('foo', 'bar', 'baz') as $v) { $options[$v] = $v; $k = 'test_select_toggles_' . $v; $toggles[$v] = array($k); $unlimitedToggles[] = $k; $elements[] = new \IPS\Helpers\Form\Text( $k, '', false, array(), null, null, null, $k ); } $form->add(new \IPS\Helpers\Form\Select( 'test_select_toggles_select', $selected, false, array( 'options' => $options, 'toggles' => $toggles, 'multiple' => true, 'unlimited' => -1, 'unlimitedToggles' => $unlimitedToggles, ) )); foreach ($elements as $element) { $form->add($element); } Result All works as expected Change $selected = -1; to $selected = 'foo'; Result It should also display test_select_toggles_foo element. Remove 'unlimitedToggles' => $unlimitedToggles, Result So there is a conflict between 'toggles' and 'unlimitedToggles'
bfarber Posted January 16, 2020 Posted January 16, 2020 I've logged a bug report to have this looked into.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.