Wouldn't it be better to check this in the form validation?