function smarty_block_select($params, $content, $template, &$repeat)
{
    if ($repeat) {
        // Skip the first time
        return;
    }
    $attr = get_attr($params, $template);
    $field = get_field($params, $template);
    $CI =& get_instance();
    if (isset($field->model)) {
        $CI->load->model($field->model);
        $parent_vars = $template->parent->tpl_vars;
        $form_data = get_form_data($parent_vars);
        $options = widget_select_get_options(get_default($params, 'options', array()), $form_data, $field, $CI->{$field->model});
    } else {
        $options = get_default($params, 'options', array());
    }
    $attr['url'] = current_url();
    if (isset($field->filters)) {
        $hasfield = false;
        $rel = array();
        foreach ($field->filters as $key => $filter) {
            if (isset($filter->field)) {
                $rel[] = $filter->field;
                $hasfield = true;
            }
        }
        if ($hasfield) {
            $attr['data-rel'] = implode(',', $rel);
        }
    }
    if (isset($params['noselectboxit']) && $params['noselectboxit'] != '') {
        $attr["data-no-selectBoxIt"] = true;
    }
    $parent_vars = $template->parent->tpl_vars;
    $form_data = get_form_data($parent_vars);
    $selected = get_default($params, 'selected', array());
    $extra = _parse_form_attributes($attr, array());
    if (count($selected) == 0) {
        $selected = $attr['value'];
    }
    return form_dropdown($attr['name'], $options, $selected, $extra);
}
 function selectProcess()
 {
     $field = $this->input->get('field');
     $detail = $this->input->get('detail');
     if ($field && $detail) {
         $field = $this->getField($field);
         if ($field && isset($field->model)) {
             $this->load->model($field->model);
             $this->jsonOut(widget_select_get_options(array(), (object) $detail, $field, $this->{$field->model}));
         } else {
             show_error("The field {$field} is not valid!");
         }
     } else {
         show_error('The select request is not valid!');
     }
 }