refactored some of the javascript code for disabling of buttons as it will be repeated on multiple forms