Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions views/default/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,36 +192,7 @@

echo Html::beginTag('div', ['class' => 'col-md-9']);
echo $form->field($survey, "survey_tags")->input('text', ['placeholder' => 'Comma separated']);
if ($withUserSearch) {
echo Html::tag('div', '', ['class' => 'clearfix']);
echo $form->field($survey, 'restrictedUserIds')->widget(Select2::classname(),
[
'initValueText' => $survey->restrictedUsernames, // set the initial display text
'options' => ['placeholder' => \Yii::t('survey', 'Restrict survey to selected user...')],
'pluginOptions' => [
'allowClear' => true,
'minimumInputLength' => 3,
'language' => [
'errorLoading' => new JsExpression("function () { return 'Waiting for results...'; }"),
],
'ajax' => [
'url' => Url::toRoute(['default/search-respondents-by-token']),
'dataType' => 'json',
'data' => new JsExpression('function(params) { return {token:params.term}; }')
],
'multiple' => true,
'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
'templateResult' => new JsExpression('function(city) { return city.text; }'),
'templateSelection' => new JsExpression('function (city) { return city.text; }'),
],
'pluginEvents' => [
'change' => new JsExpression('function() {
var container = $(this).closest(\'[data-pjax-container]\');
container.find(\'button[type=submit]\').click();
}')
]
]);
}

echo Html::endTag('div'); // col-md-9
echo Html::endTag('div'); // row

Expand Down