public function generateForm() { $this->property->action = $this->property->action ?: Manager::getCurrentURL(); \Maestro\Utils\MUtil::setIfNull($this->property->method, 'POST'); \Maestro\Utils\MUtil::setIfNull($this->style->width, "100%"); $this->property->role = "form"; $fields = $buttons = $help = $tools = ""; $fields = $this->generateFields(); $buttons = $this->generateButtons(); $help = $this->generateHelp(); if ($this->tools != NULL) { mdump('has tools'); $tools = $this->generateTools(); } // menubar if ($this->property->menubar) { $menubar = PainterControl::generate($this->property->menubar); } // por default, o método de submissão é POST \Maestro\Utils\MUtil::setIfNull($this->property->method, "POST"); if ($this->property->onsubmit) { PainterControl::getPage()->onSubmit($this->property->onsubmit, $this->property->id); } // se o form tem fields com validators, define onSubmit $validators = ''; if (count($this->property->toValidate)) { PainterControl::getPage()->onSubmit("\$('#{$this->property->id}').form('validate')", $this->property->id); $validators = implode(',', $this->property->bsValidator); } //mdump($fields); // obtem o codigo html via template $inner = PainterControl::fetch('painter/formdialog', $this, ['fields' => $fields, 'buttons' => $buttons, 'help' => $help, 'tools' => $tools, 'validators' => $validators, 'menubar' => $menubar]); return $inner; }