fixed and rearranged js file and fixed some code errors in validate form to not bring invalid submission page.