Validation not working

As I posted in your other topic, unless they are “anything goes” - which is rarely the case - you need to do some critical thinking regarding the input values

If you can describe what an input value needs to be in the form of a sentence then “translating” to code will not be that difficult.

As a contrived example

Must have a minimum of three characters and a maximum of ten characters.
Only numeric characters, spaces and dashes are allowed.
A space can not be adjacent to another space or a dash
If there are dashes, there must be a minimum of two digits and a maximum of four digits between and outside of the dashes.

etc.