JS functionality for edit page. still needs some cleaning up and refining, but the skeleton is there and ready to be plugged into the backend app