protected function commonJs() { $jsContent = ''; if ($this->ctrl->isReadOnly()) { $jsContent .= "c.readOnly = true;\n"; } if ($this->ctrl->required) { $jsContent .= "c.required = true;\n"; if ($this->ctrl->alertRequired) { $jsContent .= "c.errRequired=" . $this->escJsStr($this->ctrl->alertRequired) . ";\n"; } else { $jsContent .= "c.errRequired=" . $this->escJsStr(\jLocale::get('jelix~formserr.js.err.required', $this->ctrl->label)) . ";\n"; } } if ($this->ctrl->alertInvalid) { $jsContent .= "c.errInvalid=" . $this->escJsStr($this->ctrl->alertInvalid) . ";\n"; } else { $jsContent .= "c.errInvalid=" . $this->escJsStr(\jLocale::get('jelix~formserr.js.err.invalid', $this->ctrl->label)) . ";\n"; } if (!$this->parentWidget->controlJsChild()) { $jsContent .= $this->builder->getJFormsJsVarName() . ".tForm.addControl(c);\n"; } $this->parentWidget->addJs($jsContent); }