I need a method to validate a field for numeric input only before page submit so I'm trying to use a dynamic action on lose focus or on change. I can't get it to work properly been trying to use a condition for RegEx similar to RegExp('^[0-9]$') I can't get it to work.
Apex does give an error message that looks like this (after a lose focus on a numeric field if it contains non numeric data)

This error is not graceful I need to prevent the error shown and show the user a more friendly error message that I can display some custom text in. This is apex 4.2, Tomcat running on the server.
Any suggestions? I did a search but can only find server side validations or validation other than non numeric, Any help would be appreciated, regards.