Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript on Customfield not executed when Project is switched on Create Screen

Robin Sadlo February 19, 2019

Hey,

I am providing a customfield with custom velocity templates for view and edit.
On edit there is some javascript required, so imagine the customfield-edit.vm to look like this:

<div>
<input></input>
</div>

<script>
var data = ${dataFromVelocity};

AJS.toInit(function(){
alert('test');
});
</script>

 Now if i open the create dialog, where another project, which does not contain my custom field, is selected and then switch to a project with my customfield, the js is not executed.

On the other hand if the create dialog opens with the correct project selected, the js will execute as intended.

is there any way to get this working from the velocity template rather than creating an additional javascript file, which will be loaded with the customfield?

 

Thanks

Robin

0 answers

Suggest an answer

Log in or Sign up to answer