In Product details page we are having the quantity field, by default it accepts strings and negative numbers. we can fix this issue very easily just by adding class names.
app->design->frontend->default-> <your theme> ->template->catalog->product->view->addtocart.phtml
in line 33 you can see the text filed with id="qty", just add the following classes for that field
You can see all the validation classes in