fixed minor JS bug, implemented server-side form validation