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

How to check if a template is loaded within actionSave

arms

Active member
#1
So I've managed to add custom filed to the thread.

I have some validation in actionsave, but it should only run when the template is available.

Any one know how i'd find myFormShown ?


Code:
$session = false;
        if (XenForo_Application::isRegistered('session'))
            {
                /** @var $session XenForo_Session */
                $session = XenForo_Application::get('session');
            }
        
        /*if (!$myFormShown || !$session)*/
        if ( !$session)
            {
                if ($session)
                {
                    $session->remove('myForm');
                }
                return parent::actionSave();
            }
                
         $inputData = $this->_input->filter(array(
                'string1' => XenForo_Input::STRING,
                'string2'=> XenForo_Input::STRING,
                'type' => XenForo_Input::UINT               
                ));
                            
        if (!$inputData['type'])
        {
            throw new XenForo_Exception(new XenForo_Phrase('you_must_select_type'), true);
            return $this->responseError(new XenForo_Phrase('you_must_select_type'));
        }

        $session->set('myForm', $inputData);
                    
            return parent::actionSave();
        }