form.js contains common code for validation