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

Modal Form

Discussion in 'Help' started by DiamondGamer30, Jun 6, 2018.

  1. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Can someone help me with ModalForms? I tried to implement forms-api (created by pmmp) into the pocketmine source but it wouldn't work. I don't think I'm doing anything wrong. I added the functions to the Player class, I added the form folder, I also modified handleModalFormResponse() in PlayerNetworkSessionAdapter. I also tried to add it as a plugin but the form would never send and there would be no console errors. What could I possibly be doing wrong, can anyone name possible errors? If you are wondering why I am doing this, it is because I find it the most easiest to use and pmmp would probably never implement this lol (or take ages).
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    You have about 10000 possible errors. Try narrowing it.
     
    dktapps likes this.
  3. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    I honestly can't find any errors, the formData part seems fine, sending the packet seems fine too. I'm not sure if I'm doing anything wrong with handling the response. I had took the formapi from the pmmp branch, so any other functions you are looking for, you'll be able to find there.

    PHP:
    public function onDataPacketReceive(DataPacketReceiveEvent $event) {
        
    $packet $event->getPacket();
        
    /** @var CorePlayer $player */
        
    $player $event->getPlayer();
        if(
    $packet instanceof ModalFormResponsePacket) {
            
    $id $packet->formId;
            
    $data json_decode($packet->formData);
            
    $player->onFormSubmit($id$data);
        }
    }
     
  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.