function recursiveRender() { // if folder is wrong for model folder not loaded so return if ($this->folder_id === 0) { return parent::recursiveRender(); } // on click on new button open modal popup $js = [$this->js()->_selector('#' . $this->modal_popup->name)->modal(), $this->js()->_selector("#" . $this->modal_popup->name . " .modal-header h4")->text($this->js()->_selectorThis()->data('title')), $this->js()->_selector("#" . $this->modal_popup->name . " #" . $this->field_new_type->name)->val($this->js()->_selectorThis()->data('documenttype'))]; $this->action->js('click', $js)->_selector('li.xepan-new-document'); // form submition handle if ($this->form->isSubmitted()) { try { $this->api->db->beginTransaction(); $document_model = $this->add('xepan\\hr\\Model_' . $this->form['add_new_document_type']); $document_model->createNew($this->form['name'], $this->form['folder_id']); $this->api->db->commit(); } catch (Exception $e) { $this->api->db->rollback(); $this->form->js()->univ()->errorMessage('error occured ' . $e->message())->execute(); } $js = [$this->js()->_selector('#' . $this->modal_popup->name)->modal('toggle')]; $this->form->js(null, $js)->univ()->successMessage("Added Successfully")->execute(); } parent::recursiveRender(); }