1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

SimpleForm FormAPI

Discussion in 'Development' started by NickteeChunky, Jul 20, 2019.

  1. NickteeChunky

    NickteeChunky Witch

    Messages:
    64
    GitHub:
    nickteechunky
    Hi, I'm new to using forms and PMMP development in general, I'd just like to know, how do I direct a button to another form using SimpleForm. In this case, how do I direct the "test" button to another UI, so when you click the button it sends you to another UI that I can edit.

    Code:
            $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");
            $form = $api->createSimpleForm(function (Player $player, int $data = null){
                        $result = $data;
                        if ($result === null) {
                            return;
                        }
                        if($result === 0) {
                          
                        }
                  
                        switch ($result) {
                            case 0:
                            break;
                        }
                    
                        return;
                    } );
                    $form->setTitle("Title");
                    $form->setContent("yay content");
                    $form->addButton("test");
                    $form->sendToPlayer($player);
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Just create another form inside
    PHP:
    if($result === 0) {
    $newform 
    $api->createSimpleForm(function (Player $playerint $data null){});
    //...
    $player->sendForm($newform);
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.