An attempt to consolidate some of the form handling JS

First attempt at reducing some inconsistent behavior in the 'add tracker' and
'add time' modals, and re-organizing some front-end code.