Looking for old forum posts and information? View the old forum archive here ยป
Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

A static copy of our previous forums website is available online for reference. Click here to access the forum archive.

Learn more about...

AspDotNetStorefront
DotFeed

The order form quantity field accepts any character, numeric or not.

If you enter any non-numeric character in the quantity field on the order form, it places qty. 1 of the item in the cart. Can this be set to not accept non-numeric characters?

Thanks!
asked Oct 15, 2014 in MultiStore by lposson (170 points)

1 Answer

+1 vote

Laura,

Correct, there is no client side enforced validation. Add to Cart will default to a quantity of 1.

You have a couple of options:

1) Restrict quantity input to numeric only. Options:

a) JavaScript. Example : http://jsfiddle.net/lesson8/HkEuf/1/

b) Qty DropDown, using the built-in Restricted Quantity feature.

2) Add server side validation, so that once the form is submited the value will be validated, and any error reported back to the user on the product page.

3) Both 1 & 2.

If going with #1, I suggest the use of JavaScript, like the example given. An HTML5 attribute can be used, but some older browsers will not support that feature.

Sincerely,
Robert

answered Oct 21, 2014 by Robert (3,440 points)
edited Oct 21, 2014 by Robert
Thanks, Robert! That's very helpful!
...