Open Bounce182 opened 4 years ago
I'm trying to load autocomplete widget in bootstrap modal window:
Modal::begin( [ 'header' => '<h3>User search</h3>', 'id' => 'modal', 'size' => 'modal-lg' ] ); echo '<div id="modalContent"></div>'; Modal::end();
Popup loading:
$(document).ready(function () { $('#modalButton').click(function () { $('#modal').modal('show').find('#modalContent').load($(this).attr('value')); }); });
Form:
$form = ActiveForm::begin( [ 'id' => 'user-search-form', 'enableAjaxValidation' => true, 'validateOnChange' => false, 'validateOnBlur' => false ] ); $form->field($model, 'userId')->widget(keygenqt\autocompleteAjax\AutocompleteAjax::class, [ 'url' => ['users/search'], 'options' => ['placeholder' => 'Enter user title'] ]); ActiveForm::end();
It loads the modal window with the autocomplete field inside, but it looks like widget can't reach jquery UI autocomplete function:
Uncaught TypeError: $(...).autocomplete is not a function
Any ideas?
the view of the component must be corrected, since the javascript must be executed after the jquery is loaded
I'm trying to load autocomplete widget in bootstrap modal window:
Popup loading:
Form:
It loads the modal window with the autocomplete field inside, but it looks like widget can't reach jquery UI autocomplete function:
Any ideas?