{"action":"opened","issue":{"url":"https://api.github.com/repos/kartik-v/yii2-builder/issues/89","labels_url":"https://api.github.com/repos/kartik-v/yii2-builder/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/kartik-v/yii2-builder/issues/89/comments","events_url":"https://api.github.com/repos/kartik-v/yii2-builder/issues/89/events","html_url":"https://github.com/kartik-v/yii2-builder/issues/89","id":91527151,"number":89,"title":"How to get default value displayed in Select2 widget using form builder","user":{"login":"derekisbusy","id":5118781,"avatar_url":"https://avatars.githubusercontent.com/u/5118781?v=3","gravatar_id":"","url":"https://api.github.com/users/derekisbusy","html_url":"https://github.com/derekisbusy","followers_url":"https://api.github.com/users/derekisbusy/followers","following_url":"https://api.github.com/users/derekisbusy/following{/other_user}","gists_url":"https://api.github.com/users/derekisbusy/gists{/gist_id}","starred_url":"https://api.github.com/users/derekisbusy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekisbusy/subscriptions","organizations_url":"https://api.github.com/users/derekisbusy/orgs","repos_url":"https://api.github.com/users/derekisbusy/repos","events_url":"https://api.github.com/users/derekisbusy/events{/privacy}","received_events_url":"https://api.github.com/users/derekisbusy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-27T23:03:47Z","updated_at":"2015-06-27T23:03:47Z","closed_at":null,"body":"I'm trying to get a default value selected using Select2 widget inside of form builder. Here is my code:\r\n\r\n```php\r\n    echo Form::widget([\r\n    'model' => $mailingAddressModel,\r\n    'form' => $form,\r\n    'columns' => 3,\r\n    'attributes' => [\r\n        'state_id'=>['type'=> Form::INPUT_WIDGET, \r\n            'widgetClass'=>Select2::classname(),\r\n            'options'=>[\r\n                'value'=>'33',\r\n                'initValueText' => 'NM', \r\n                'options' => [ 'id' => 'mailingAddressState'],\r\n                'data'=>\\common\\models\\GeoState::getStates()\r\n            ],\r\n            'hint'=>'Type and select state'], \r\n    ]]);\r\n\r\n```"}}