#80 – Entering a quantity enables user to add product to cart without filling in required field!

Posted in ‘ReqText VirtueMart Plugin’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Friday, 30 October 2020 12:05 CET
Hi! If I enter a number to the quantity box of a product and press the Enter key, the product is being added to the cart, although I have not filled in the required fiels. As well as clicking the cart button, entering a quantity should also trigger the "Required field" check. Kind regards, Gerald
Custom Fields
ReqText Plugin version 1.60
gmr-foto
Monday, 02 November 2020 10:39 CET

This "problem" occures when a script has some sort of error. Please check for any other plugins using any jQuery / JavaScript which could trigger this issue.

Also check, if you have made some changes to the source files of ReqText, accidently a mistake has slipped in. ReqText V1.60 works correctly in a newly installed VirtueMart environment using the correct configured required fields.
Even when a quantity is entered using the [ENTER] key.

Bug? That's not a bug, that's a feature. :-)

uwix
Monday, 02 November 2020 11:20 CET
Hi! Thank you for your reply. The only changes to the source files I have written to you in my tickets - they do not have any effect on that. It seems as if that issue was connected somehow with my template. How can I find out, what is the difference between pressing the 'Add to cart' button and entering a quantity? Thank you for any useful hint! Kind regards, Gerald
gmr-foto
Thursday, 12 November 2020 09:03 CET

There should not be any difference between using [ENTER], entering a quantity or clicking the Add to cart button. If some how an error occurs on a page in any used script and comes in conflict with the custom*.js script for the required fields - the required script get's bypassed.

You've find out the template is/was causing the conflict - which could be the reason this issue appears.

Bug? That's not a bug, that's a feature. :-)

uwix
Wednesday, 09 December 2020 15:14 CET
Hello! If I correctly interpreted /plugins/vmcustom/reqtext/assets/js/customvmprices.js:15, you are checking for required fields solely on clicking the add-to-cart button. But you do not on entering a number into the quantity box, nor on entering something in a text product field, nor on pressing the Space or Enter key on the add-to-cart button. In other words: You check the validity of the form submission on _clicking_ the add-to-cart button, only - in all other ways of submitting the form you do not check for the required fields. Please confirm. And could you, please, have a look on fixing that - thank you very much in advance! Kind regards, Gerald
gmr-foto
Wednesday, 09 December 2020 15:37 CET

The Add-to-cart button is the only way to send the filled form. If you press ENTER it actually presses the Add to Cart Button.

Just tested on https://demo.uwix.nl to enter a number and press the ENTER button. The required fields still popup. Also after using TAB to switch to the Add to Cart button and using SPACE and ENTER the result is the same.

It's not usefull to check every seperate field because using ENTER is still just sending the form or better said "it presses the Add to Cart button".

We'll do some more testing later this week, just to be sure.

Bug? That's not a bug, that's a feature. :-)

uwix
Thursday, 10 December 2020 16:16 CET
Hi! Thank you for your reply. Your hints led me to the real source of the issue: The template I am using wrapped the add-to-cart input field with a button element having the same name and type, which snatched away the click event from the input element. And as you are triggering the click event with the selector 'input.addtocart-button' instead of '*[name="addtocart"]', all kinds of submitting the form ignored the 'required check', except hitting the add-to-cart button directly ;)
gmr-foto
Wednesday, 30 December 2020 22:27 CET
Will you fix that in the next release?
gmr-foto
Tuesday, 05 January 2021 21:55 CET

The ReqText plugin does function correctly using templates and the current VM version. Because of the template your are describing an issue occurs.

The question is if we should adapt the ReqText sourcecode to this and could that be the beginning of more request to adapt the plugin to existing templates? For now there are no planes changing the working script included in the ReqText plugin.

 

Bug? That's not a bug, that's a feature. :-)

uwix
Friday, 05 February 2021 00:00 CET
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
system
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.
Support Availability

Working days: Monday to Friday. The is available 24 hours a day, 7 days a week but will only be answered during workings days according CET.
Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 48 hours. When we expect longer delays we will notify you when you file a ticket or reply.