ActiveForm - how to detect changed attributes in JS

Hi,

i am trying to figure out how to detect changed attributes in ActiveForm.

My goal is to trigger form submission if user clicked or changed any input field field within the form.

The form is pretty much standard:


<?php $form = ActiveForm::begin([

    'enableAjaxValidation' => true,

]); ?>


<?= $form->field($phase, 'frequency')->widget(SelectableOne::className(), [

    'items' => $wizard::getOptionsFreqency(),

]) ?>


<?php ActiveForm::end(); ?>

I tried probably all options based on Yii2 cookbook - but nothing worked. It looks like watched active attributes won’t bubble JS events so I am not able to detect any change via binding listeners in a standard way:


$("#phase-frequency").on('change', function(){

    alert("changed!");

});



Also Yii form listener not working:


$("#phase-frequency").on('change.yiiActiveForm', function(){

    alert("changed!");

});



I am running out of clues - does anybody have any idea how to detect any JS event on active element?

thanx a lot.

Lubos