create valadation for the click event