Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
TheJackal84 Posted June 13, 2017 Posted June 13, 2017 Is the any way to use the 'toggleson' and 'togglesoff' feature using the select or checkbox form settings For example $form->add( new \IPS\Helpers\Form\Select( 'My_Setting', \IPS\Settings::i()->My_Setting, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'My_Setting', 'options' => array( 1 => 'TogglesOn$FormX', 2 => 'TogglesOff$FormY' ), 'multiple' => FALSE ), NULL, NULL, NULL, 'My_Setting') );
newbie LAC Posted June 13, 2017 Posted June 13, 2017 For Select uses 'toggles' => array( 'key' => array( ... ) ) // IDs that each option should show/hide when toggled Example $form->add(new \IPS\Helpers\Form\Select( 'setting1', \IPS\Settings::i()->setting1, false, array( 'options' => array( 'option1' => 'option1_title', 'option2' => 'option2_title' ), 'toggles' => array( 'option1' => array('setting2'), 'option2' => array('setting3'), ) ) )); $form->add(new \IPS\Helpers\Form\Number( 'setting2', \IPS\Settings::i()->setting2, false, array(), null, null, null, 'setting2' )); $form->add(new \IPS\Helpers\Form\Text( 'setting3', \IPS\Settings::i()->setting3, false, array(), null, null, null, 'setting3' ));
TheJackal84 Posted June 13, 2017 Author Posted June 13, 2017 12 minutes ago, newbie LAC said: For Select uses 'toggles' => array( 'key' => array( ... ) ) // IDs that each option should show/hide when toggled Example $form->add(new \IPS\Helpers\Form\Select( 'setting1', \IPS\Settings::i()->setting1, false, array( 'options' => array( 'option1' => 'option1_title', 'option2' => 'option2_title' ), 'toggles' => array( 'option1' => array('setting2'), 'option2' => array('setting3'), ) ) )); $form->add(new \IPS\Helpers\Form\Number( 'setting2', \IPS\Settings::i()->setting2, false, array(), null, null, null, 'setting2' )); $form->add(new \IPS\Helpers\Form\Text( 'setting3', \IPS\Settings::i()->setting3, false, array(), null, null, null, 'setting3' )); Cheers I will give it a shot after breakfast I'm starving lol
TAMAN Posted June 13, 2017 Posted June 13, 2017 $form->add( new \IPS\Helpers\Form\Select( 'My_Setting', \IPS\Settings::i()->My_Setting, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'My_Setting', 'options' => array( 1 => 'options1', 2 => 'options2' ), 'toggles' => array( 1 => array('togglethis_setting', '',''), 2 => array('') ) ), NULL, NULL, NULL, 'My_Setting')); Edit Sorry, didn't see newbie LAC's post anyways, same thing
Recommended Posts
Archived
This topic is now archived and is closed to further replies.