event for the ok button