form.js refactoring