I am doing some form validation and I want to call a fucntion from my input box that will prevent users from enetring in a space or a "-"...

How can I prevent users from enetring in spaces or "-" into the text box