/** * Partial method to refresh the add/edit field for this attribute. * * @param string $mode add/edit mode * * @return string HTML the output needed to refresh the attribute. */ public function partial_refresh($mode) { $record = $this->m_ownerInstance->updateRecord(); $fieldprefix = $this->m_ownerInstance->m_postvars['atkfp']; $arr = array('fields' => array()); $defaults =& $record; $error = []; $this->addToEditArray($mode, $arr, $defaults, $error, $fieldprefix); $script = ''; foreach ($arr['fields'] as $field) { //Json::encode expect string in in ASCII or UTF-8 format, so convert data to UTF-8 $value = Tools::atk_iconv(Tools::atkGetCharset(), 'UTF-8', $field['html']); $script .= "\$('" . str_replace('.', '_', $this->m_ownerInstance->atkNodeUri() . '_' . $field['id']) . "').update(" . Json::encode($value) . ");\r\n"; } return '<script type="text/javascript">' . $script . '</script>'; }