Improve JS validation. Popup & non-popup