Added option to auto clear invalid input values

Added option to auto clear invalid input values, as mentioned in #12. If you like it you can merge it. Feel free. And if there are any changes required, you can let me know.