i saw a person comment this: PHP: $form = $this->getServer()->getPluginManager()->getPlugin("FormAPI")->createCustomForm(function (Player $sender, array $data) { var_dump($data); // Sends all data to console});$form->setTitle("Form Title");$form->addLabel("Text");$form->addToggle("Toggle");$form->addSlider("Slider", 1, 100); // Slider, Min 1, Max 100$form->addStepSlider("Step Slider", ["5", "10", "15"]); // Step Slider, 5, 10 & 15$form->addDropdown("Dropdown", ["1", "2", "3"]); // Dropdowm, Options 1, 2 & 3$form->addInput("Input", "Ghost Text", "Text"); // Input, Text already entered but how do you get the result for toggle, sliders, dropdown, inputs?
The code you sent is var_dumping the value of $data to console, take a lookat that to see what the data looks like
i did, but I don't get the result if its true PHP: $form = $this->core->getServer()->getPluginManager()->getPlugin("FormAPI")->createCustomForm(function (Player $player, array $data) { var_dump($data); $result = $data[0]; switch ($result) { case 0 : if ($result == true) { $player->sendMessage("true"); } else { $player->sendMessage("false"); } return; } }); $form->setTitle("Form Title"); $form->addToggle("Toggle"); I get the false message when i switch it to false and submit but i dont get any message when i toggle the switch to true var dump Code: array(1) { [0]=> bool(true) } array(1) { [0]=> bool(false) }