initial form validation
extracted javascript