How to add JavaScript code to contributor form in OMP 3.4

Hi everyone,

I have a question regarding the contributor form in OMP 3.4. For OMP 3.3. I used Common::UserDetails::AdditionalItems to add a new field + javascript via a template. For OMP 3.4. I used Form::config::before to add a new field like so:

$form->addField(new FieldText('myField', [
            'label' => __('plugins.generic.myField.field.title'),
	        'description' => __('plugins.generic.myField.field.desc'),
            'isRequired' => true,
        ]), [FIELD_POSITION_BEFORE, 'email']);

However, I am not sure how to add JavaScript this way. I found this post that suggested to use FieldHTML: Insert in submission_settings table - #6 by tnier01

But maybe there is a better way to do this (or a hook that I am overlooking)?

Best,
Tina