adds event handlers for formpanel