Location: PHPKode > projects > The Fresh Toolkit > fresh-0.1.213/code_templates/actions/AJAXFFormAction.tpl
<?php
class /*$actionName*/Action extends FreshLoggedAction
{
    private $form;
    
    public function getFForm() 
    {
        if ($this->form) return $this->form;
        $form = new FForm($this->getContext() , "/*$actionName*/Form");
        $form->setParameter("AJAXTargetModule","/*$moduleName*/");
        $form->setParameter("AJAXTargetAction","/*$actionName*/");
        $form->setParameter("title","/*$actionName*/_title");
		//------------------------- FORM CUSTOMIZATION HERE ------------------
		//--------------------------------------------------------------------
        $this->form = $form;
        return $this->getFForm();
    }
    
    public function execute() 
    {
        if ($this->getFForm()->submitted()) {
            $this->getFForm()->fill($this->request->getParameters()); 
            if($this->getFForm()->validate())
            {
				//------------------------- FORM CUSTOMIZATION HERE ------------------
				$this->getFForm()->addMessage("/*$actionName*/Form Validated Correctly");
				//--------------------------------------------------------------------
            } else $this->getFForm()->addError("/*$actionName*/Form did not validate");  
        }
        return $this->getDefaultView();
    }
    
    public function getDefaultView() 
    {
		if($this->request->hasParameter($this->getFForm()->getName().'swExp')) 
		{
			$propname = $this->getFForm()->getName().'ExpStatus';
			$current =  $this->user->getAttribute($propname);
			$this->user->setAttribute($propname, $current=="contracted"?"expanded":"contracted"); 
		}
		//------------------------- FORM CUSTOMIZATION HERE ------------------
		//--------------------------------------------------------------------
        $this->request->setAttribute('form', $this->getFForm()->getFormArray());
        return View::INPUT;
    }
    
    public function getRequestMethods() 
    {
        return Request::POST;
    }
}
?>
Return current item: The Fresh Toolkit