A. if you want to apply it on field whenever it get added to any view of any module then add your JS file in field definition. Path will be like this: custom/include/SugarFields/Fields//EditView.tpl and code will be like following:
<script type="text/javascript" src='{sugar_getjspath file="custom/include/SugarFields/Fields/<your_field_type>/js_file_name.js"}'>
</script>
B. if you want to apply js code in any specific module in specific view then use following sample method:
Add a reference to the javascript file which will be needed for event binding.
Path: custom/modules/Contacts/metadata/editviewdefs.php
Code:
<?php
$viewdefs['Contact']['EditView']['templateMeta']['includes'] =
array (
array (
'file' => 'custom/modules/Contacts/js/editview.js',
),
);
?>
Add the javascript file you want to include into the location you referenced above(custom/modules/Contacts/js/editview.js).
Quick Repair, then hard refresh your browser. All Done !