XD-1615 Improve form validation