What's your biggest current challenge? Have your say in Community Polls along the right column.

Validate quantity selector and text area input

Validate quantity selector and text area input

Mark2019
Visitor
1 0 0

Hi all.

I am using the Dawn theme. And on a specific product I have a quantity selector and a text area where a user can list the label names they want  based on the quantity they selected (see screenshot below). I would like a way to validate the quantity selected to ensure that it corresponds to the number of listed labels.

I can write a script that can count the number of listed labels in the text area, but I am struggling to find a way to validate it with the count on the quantity selector.   The reason for this validation is because we are having challenges where our customers may list "more than" or "fewer than" the label quantity number they specified in the quantity selector. For example, they may choose they want 5 labels, but write only four label names or write 6 label names in the text area.

So I would like the validation to occur when the "Add to Cart" button is clicked to ensure that the labels are only added to cart if the quantities are identical.

Any help will be most appreciated.

dawn.png

Replies 0 (0)