Is it possible to put js file after active form assets, when the file added via registerJsFile?
I have this code, but the file will be added after yii.js, but before yii.activeForm.js, and I can't find the right call at the moment:
$this->registerJsFile('@web/js/address.js', [
'depends' => [\yii\web\YiiAsset::className()]
]);
It is yii\widgets\ActiveFormAsset
which you need to add the dependency to.
You need to add the dependency in the following way
$this->registerJsFile('js/buy-now.js', [
'depends' => [yii\widgets\ActiveFormAsset::className()],
]);
you can always check the source code for any specific widget class to see the name of the assets file that it is using inside the registerClientScript()
.
See ActiveForm
source