-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable "Add to cart" button for negative number of items #168
Conversation
@DurkoMatko Thanks! I noticed in my testing using 'onchange' on the number field means that the 'Add to cart' button doesn't re-enable until I click outside of the number field, which may be confusing. Did you happen to look at using the 'min' html attribute on the field instead of custom JS to enforce this? |
@jamescrowley nope, I haven't. Will look at it today in the evening. The outside click is indeed needed, I found out yesterday while writing tests as well :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 suspect if we can do the 'min' attribute, then none of the JS update is needed. but if it is, then yah will probably need to listen to 'click' in addition to 'onchange'.
@jamescrowley hmm 'min' doesn't work...there's also try to use it in generating QR codes. That field also is supposed to have min value (see qr.php) but the form.php which is responsible for generating fields seems to ignore it..No idea why. I could add some handler on the field which would automatically revert value to 1 if user input is less then or equal to zero? Or spend more time trying to make the 'min' happen..but probably during the weekend first. Not sure why you suggest listening to click event. |
Had a bit of a dig, pretty sure we need to add
to https://github.com/boxwise/dropapp/blob/master/templates/cms_form_number.tpl
Sorry, ignore - I remember some cases you had to listen to click in addition to on change when the focus left fields... suspect it would have to be something else in this case, but if ^^^ works we shouldn't need it |
1156714
to
f0bc16f
Compare
??? Update: here new PR - #176 |
Now that you got it working on a new branch, you could do something like
which would check out this branch, reset it to the same as add-min-attribute-to-number-input-template, and push force here. But no need - I'll just review on the other PR |
fix: add to cart button disabled for negative number of items