event handlers for validation of input