add method to attach js event after submitting the form

fixes #300