Completed functionality of validateForm().