form.js: fix in event_handler(); some code refactoring