1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

page node: form data to callback method

Discussion in 'XenForo Development Discussions' started by localhost8080, Mar 14, 2015.

  1. localhost8080

    localhost8080 Well-Known Member

    Hello folks.

    I Have a page node that is generated by my callback method.

    Now I want to add some form fields and submit them to my callback class method.

    Some one can help me how to pass the data to my callback class?

    Thank you.
     
  2. Lawrence

    Lawrence Well-Known Member

    An example from an addon I created for my site, with the actual code removed to keep it short:

    The page callback that is used in the page node to point to:
    PHP:
    class Icewind_IcewindDale_PageCallback_TrainingHall
    {
        public static function 
    trainingHall(XenForo_ControllerPublic_Abstract $controllerXenForo_ControllerResponse_Abstract $response)
        {
            
    $visitor XenForo_Visitor::getInstance()->toArray();
           
    // do some checks and retrieves data from the db

            
    $response->params['char_data'] = $characterData;

            
    $response->templateName 'icewinddale_training_hall';
        }
    }
    Controller the form uses:

    PHP:
    class Icewind_IcewindDale_ControllerPublic_TrainingHall extends XenForo_ControllerPublic_Abstract
    {
        public function 
    actionHelp()
        {
            
    $optionsHelp $this->_input->filterSingle('traininghall'XenForo_Input::STRING);
           
    // retrieve relevant data
            
    $viewParams = array('optionsHelp' => $charOptionsHelp);

            return 
    $this->responseView(
                
    'Icewind_IcewindDale_ViewPublic_Training_Hall_Help',
                 
    'icewinddale_training_hall_help',
                 
    $viewParams
            
    );
           }
    }
     

Share This Page