combobox A jQuery combobox, based on autocomplete

  1. Requirements
  2. Usage
  3. Resources

A jQuery combobox, allowing selecting items from a list or typing them in. This is done by combining a select, text field, and button.

As it extends the included JUI widget, theming will respect your customizations.

Contributions welcome !!

Requirements

Developed and tested on Yii 1.1.7, should work on any 1.1.x branch.

Usage

Extract to your extensions folder.

In your view file :

$this->widget('ext.combobox.EJuiComboBox', array(
    'model' => $myModel,
    'attribute' => 'myAttribute',
    // data to populate the select. Must be an array.
    'data' => array('yii','is','fun','!'),
    // options passed to plugin
    'options' => array(
        // JS code to execute on 'select' event, the selected item is
        // available through the 'item' variable.
        'onSelect' => 'alert("selected value : " + item.value);',
        // JS code to be executed on 'change' event, the input is available
        // through the '$(this)' variable.
        'onChange' => 'alert("changed value : " + $(this).val());',
        // If false, field value must be present in the select.
        // Defaults to true.
        'allowText' => false,
    ),
    // Options passed to the text input
    'htmlOptions' => array('size' => 10),
));

Resources

  • Try out a demo, but note the jQuery example will remove a value if it is not in the source list. In the extension this behavior is configurable (allowText option).
  • Github Fork it !
9 0
31 followers
3 442 downloads
Yii Version: 1.1
License: LGPL-3.0
Category: User Interface
Developed by: ianaré
Created on: Jun 7, 2011
Last updated: 6 years ago

Downloads

show all

Related Extensions