public static function renderListTypeSelect($uniqName, $fieldName, $value) { $language = OW::getLanguage(); $field = new Selectbox($fieldName); $uniqId = uniqid("select-list-"); $field->setId($uniqId); $field->setOptions(array('latest' => $language->text('ucarousel', 'widget_list_type_latest'), 'recently' => $language->text('ucarousel', 'widget_list_type_recently'), 'online' => $language->text('ucarousel', 'widget_list_type_online'), 'featured' => $language->text('ucarousel', 'widget_list_type_featured'), 'by_role' => $language->text('ucarousel', 'widget_list_type_by_role'), 'by_account_type' => $language->text('ucarousel', 'widget_list_type_by_account_type'))); $field->setValue($value); if ($value != "by_role") { OW::getDocument()->addOnloadScript('$("#uc-role-setting").parents("tr:eq(0)").hide();'); } if ($value != "by_account_type") { OW::getDocument()->addOnloadScript('$("#uc-account-type-setting").parents("tr:eq(0)").hide();'); } OW::getDocument()->addOnloadScript('$("#' . $uniqId . '").change(function() { ' . '$("#uc-role-setting").parents("tr:eq(0)").hide(); ' . '$("#uc-account-type-setting").parents("tr:eq(0)").hide(); ' . 'if ($(this).val() == "by_role") $("#uc-role-setting").parents("tr:eq(0)").show(); ' . 'if ($(this).val() == "by_account_type") $("#uc-account-type-setting").parents("tr:eq(0)").show(); ' . ' })'); return $field->renderInput(); }