Example I use:
JS is on applications/movies/dev/js/front/controllers/movies/ips.movies.submit.js
On JS:
;( function($, _, undefined){
"use strict";
ips.controller.register( 'movies.front.movies.submit', {
initialize: function()
On template:
<form accept-charset='utf-8' class="ipsForm {$class}" action="{$action}" method="post" {{if $uploadField}}enctype="multipart/form-data"{{endif}} {{if settings.movies_tmdb_api_key}}data-ipsForm data-controller="movies.front.movies.submit"{{endif}}>
On a PHP file (applications/movies/modules/front/movies/submit.php) :
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_movies.js', 'movies', 'front' ) );