Fixed validateForm function and added Jasmine tests