move form validation into script file