Finished js for location form