How to restrict a textfield for certain character

Before two to three days I faced a problem in Opencart that when I enter a price value with comma then price value of product reduce because the Opencart shop takes atomatically comma within price value of Product. Then how i can get a correct price for product and it is also not possible for me to say admin or seller to add price without comma or special character. Then,how this problem will be resolved. Finally I implemented a simple logic for it and now going to share with all of you. Just see how it is possible to restrict a user for enter a comma or any special character in textfield . Just take a look.

<input type=”text” name=”phpcluster” onkeyup="this.value=this.value.replace(/\,/g, '')" />