Simple widget to transform input field to input tags field
Usage:
In your form insert
<?php echo $form->textField($model, 'tags', array('id' => 'tags')); ?>
<?php
$this->widget('ext.sinTags.SinTagsWidget', array
(
'attribute' => 'tags',
'addTagLabel' => 'Add a tag',
'autocomplete' => '/tags/Tags/tagsCompetitions',
));
?>
Params:
attribute - your id input field attribute
addTagLabel - label on text field
autocomplete - if your need autocompetitions tag, insert path to your script to generate json autocompetitions list. If this not required - not use this param.
JSON data example:
[ { "id": "Netta rufina", "label": "Red-crested Pochard", "value": "Red-crested Pochard" }, { "id": "Sterna sandvicensis", "label": "Sandwich Tern", "value": "Sandwich Tern" }, { "id": "Saxicola rubetra", "label": "Whinchat", "value": "Whinchat" }, { "id": "Saxicola rubicola", "label": "European Stonechat", "value": "European Stonechat" }, { "id": "Lanius senator", "label": "Woodchat Shrike", "value": "Woodchat Shrike" }, { "id": "Coccothraustes coccothraustes", "label": "Hawfinch", "value": "Hawfinch" }, { "id": "Ficedula hypoleuca", "label": "Eurasian Pied Flycatcher", "value": "Eurasian Pied Flycatcher" }, { "id": "Sitta europaea", "label": "Eurasian Nuthatch", "value": "Eurasian Nuthatch" }, { "id": "Pyrrhula pyrrhula", "label": "Eurasian Bullfinch", "value": "Eurasian Bullfinch" }, { "id": "Muscicapa striata", "label": "Spotted Flycatcher", "value": "Spotted Flycatcher" }, { "id": "Carduelis chloris", "label": "European Greenfinch", "value": "European Greenfinch" }, { "id": "Carduelis carduelis", "label"
: "European Goldfinch", "value": "European Goldfinch" } ]