fixed submit and added event handlers in examples