public static function statesInput($name, $params = array('value' => '', 'attrs' => '', 'notSelected' => true, 'id' => '', 'selectHtml' => '')) { if (empty($params['selectHtml']) || !method_exists(html, $params['selectHtml'])) { return false; } $params['notSelected'] = isset($params['notSelected']) ? $params['notSelected'] : true; $states = fieldAdapterGmp::getStates($params['notSelected']); foreach ($states as $sid => $s) { $params['options'][$sid] = $s['name']; } $idSelect = ''; $idText = ''; $id = ''; if (!empty($params['id'])) { $id = $params['id']; } else { $id = self::nameToClassId($name); } $paramsText = $paramsSelect = $params; $paramsText['attrs'] .= 'id = "' . $id . '_text"'; $paramsSelect['attrs'] .= 'id = "' . $id . '_select"'; $res = ''; $res .= self::$params['selectHtml']($name, $paramsSelect); $res .= self::text($name, $paramsText); if (empty($params['doNotAddJs'])) { $res .= '<script type="text/javascript"> // <!-- if(!toeStates.length) toeStates = ' . utilsGmp::jsonEncode($states) . '; toeStatesObjects["' . $id . '"] = new toeStatesSelect("' . $id . '"); // --> </script>'; } return $res; }