Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted June 13, 20177 yr 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') );
June 13, 20177 yr 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' ));
June 13, 20177 yr Author 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
June 13, 20177 yr $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
Archived
This topic is now archived and is closed to further replies.