This is a discussion forum for the yii2-widgets extension. The extension aims to extend widgets within Yii Framework 2 to offer extended functionality available in Bootstrap. You can view demo and documentation of this extension here. The widgets are classified broadly under
Another new widget has been added (category: Forms/Inputs).
[size="4"]Select2:[/size] The Select2 widget is a Yii 2 wrapper for the Select2 jQuery plugin. This input widget is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results. The widget is specially styled for Twitter Bootstrap 3. The widget allows graceful degradation to a normal HTML select or text input, if the browser does not support JQuery.
When using [font="Courier New"]tags[/font] with Select2, the tag output is not stored as an array, but a delimited (default comma separated) list. You can set the tokenSeparator for tags (check plugin documentation). Check the widget settings and browse through the [font="Courier New"]tags[/font] settings on the demos page.
For example, the following will set the ‘color’ attribute to have ‘red, black, cyan’ preselected.
// setup the following to get the existing data from database
$model->color = 'red, black, cyan';
// or if the data is an array you can preselect the tags like this
$model->color = implode(', ', ["red", "black", "cyan"]);
'model' => $model,
'attribute' => 'color',
'options' => ['placeholder' => 'Select a color ...', 'class'=>'form-control'],
'pluginOptions' => [
'tags' => ["red", "green", "white", "black", "purple", "cyan"],
'maximumInputLength' => 10
Thanks for your suggestion. I have a plan to extend gridview. However, the Yii 2 grid widget is also due for an enhancement by Yii Dev team (for example the Yii 2 Grid is expected to have PJAX). Once this is in some shape, I will try to add enhancements based on available features.
[size="3"]Select2[/size], [size="3"]DatePicker[/size], and [size="3"]Typeahead[/size] widgets have been enhanced now to work with ActiveField in a better way (no more need of passing $form property). Please change your codes in case you are using these widgets.
// Select2 with ActiveForm
echo $form->field($model, 'city')->widget(Select2::classname(), ['data' => $cities]);
// Typeahead with ActiveForm
echo $form->field($model, 'city')->widget(Typeahead::classname(), ['data' => $cities]);
// DatePicker with ActiveForm
echo $form->field($model, 'birth_date')->widget(DatePicker::classname(), ['pluginOptions'=>['autoclose' => true]);
Added NEW [size="4"]FileInput[/size] widget. This is an enhanced file input widget extending the HTML5 file input and styled for Bootstrap 3, with various features to preview multiple files and controlling your preview, input and upload options. View information and/or view details and demos.
The new problem is about the validation-errors for the second field. If I have two fields in my model: start_date and end_date and both fields are set to required. Only errors for start_date is shown and the other field is shown as if it has no errors.