I'm using custom search for my website. Now I wan't to validate user input before search like validate white-spaces (just enter space in search box and you'll find all things goes wrong).
For minimum length validation drupal take cares for minimum 3 character, but if you enter less then 3 characters and press search button search results page appears and then it shows an error that you need to enter keyword with 3 characters or more.
I don't want to go on search results page until all validation criteria passes. In this case I want just red border on search box (this is happen when no text inserted in the search box and you press search button).
How can I validate white-space, minimum search keyword length and restrict user on same page until all validation criteria passes in custom search module?