Before performing any calculations on the value from the text field just check using a regex whether every character in the text field is either a digit or a period (.) character. You could form the regex so that you can restrict the number of digits before and after the decimal point.
Salem commented: Tsk tsk, he wanted "4" help and you only gave him 3 links ;) +36
jasimp commented: He may have kept it short but he had more links ;) +9