Nette\Forms\Form::getMethod PHP Method

getMethod() public method

Returns form's method.
public getMethod ( ) : string
return string get | post
    public function getMethod()
    {
        return $this->getElementPrototype()->method;
    }

Usage Example

Example #1
0
 /**
  * Renders form begin.
  * @return string
  */
 public function renderBegin()
 {
     $this->counter = 0;
     foreach ($this->form->getControls() as $control) {
         $control->setOption('rendered', FALSE);
     }
     if (strcasecmp($this->form->getMethod(), 'get') === 0) {
         $el = clone $this->form->getElementPrototype();
         $url = explode('?', (string) $el->action, 2);
         $el->action = $url[0];
         $s = '';
         if (isset($url[1])) {
             foreach (preg_split('#[;&]#', $url[1]) as $param) {
                 $parts = explode('=', $param, 2);
                 $name = urldecode($parts[0]);
                 if (!isset($this->form[$name])) {
                     $s .= Html::el('input', array('type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])));
                 }
             }
             $s = "\n\t" . $this->getWrapper('hidden container')->setHtml($s);
         }
         return $el->startTag() . $s;
     } else {
         return $this->form->getElementPrototype()->startTag();
     }
 }
All Usage Examples Of Nette\Forms\Form::getMethod