If you want to apply JavaScript methods to your forms, you could use a selector based JavaScript library like jQuery, rather than altering the form template.
For example, if you form looks like:
<form id="SearchForm" action="" method="get">
<input type="text" name="SearchForm_Query" value="" />
<input type="submit" vlaue="submit" />
</form>
You can use require::javascript in your page template to add some js that might look like:
jQuery('#searchForm').submit(function(){
if(some expression) {
return true; // submit form;
} else {
return false; // don't submit form;
}
});
If you don't want to include the library, you could do it the old fashioned way too:
var el = document.getElementById('searchForm');
// etc....
If you actually want to change the template, you'll need to override the form field FieldHolder method. But you shouldn't need to do this. You should be able to control how it looks with CSS and what it does with included scripts. Inline JS is not template friendly :)