Can i modify yii.activeForm.js if not what is the alternative way?

yii.activeForm.js helps client side validation and allow or deny form submission. Onclick, active form calls the submitForm: function() automatically.

Now,I want to change the active form button text to "processing" during validation and disable the button upon successful validation to prevent double click.

I modified ( manually included 4 lines) the yii.activeForm.js file slightly and it works well in the way i need it.




    submitForm: function () {


     var oldtext= $('#smartbtn').text(); // manually included

     $('#smartbtn').text('Processing...'); // manually included


        var $form = $(this),

            data = $form.data('yiiActiveForm');


        if (data.validated) {

            // Second submit's call (from validate/updateInputs)

            data.submitting = false;

            var event = $.Event(events.beforeSubmit);

            $form.trigger(event);

            if (event.result === false) {

                data.validated = false;

                submitFinalize($form);

                return false;

            }

            updateHiddenButton($form);


           $('#smartbtn').attr('disabled', 'disabled');// manually included


            return true;   // continue submitting the form since validation passes

        } else {


          $('#smartbtn').text(oldtext); // manually included


            // First submit's call (from yii.js/handleAction) - execute validating

            setSubmitFinalizeDefer($form);


            if (data.settings.timer !== undefined) {

                clearTimeout(data.settings.timer);

            }

            data.submitting = true;

            methods.validate.call($form);

            return false;

        }

    },

// active form 

        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary'

        ,'id'=>'smartbtn']) ?>



However i feel it is not a good practice to modify the file generated by composer.

Is it fine to modify the yii.activeForm.js .? if not how can i implement the same without touching the yii.activeForm.js .?

I also noticed that web/asset directory has some randomly named subdirectories and not same on two projects( installation).

Ex: web/assets/e67bec0b/yii.activeForm.js

Is it for some security purpose?

Thank you.