-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
On checkout cart submit, pattern regex validation fails #23766
Comments
Hi @vahir2016. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @vahir2016 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @engcom-Bravo. Thank you for working on this issue.
|
✅ Confirmed by @engcom-Bravo Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
…op expedited Accepted Community Pull Requests: - #24665: Refactor apply options of sales rule to it's own source model to simplify extending it (by @Bartlomiejsz) - #24634: fixed getting error in console while selecting all downloadable links #24633 (by @rani-webkul) - #24153: Fix config backend model PDF file name extension (by @Vinai) - #23767: #23766 - fix pattern validation on form submit (by @vahir2016) - #24030: 24025 add caching for magento product version (by @davidverholen) Fixed GitHub Issues: - #24633: Getting error in console while selecting all downloadable links (reported by @rani-webkul) has been fixed in #24634 by @rani-webkul in 2.3-develop branch Related commits: 1. 66b7785 - #24025: Slow Performance of ProductMetadata::getVersion (reported by @beberlei) has been fixed in #24030 by @davidverholen in 2.3-develop branch Related commits: 1. f0856e8 2. ed1fb03 3. b2ca7c8 4. b397814
I believe this is fixed by 8488c07 |
Preconditions (*)
Steps to reproduce (*)
<input id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty" name="cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]" data-cart-item-id="<?= $block->escapeHtml($_item->getSku()) ?>" value="<?= /* @escapeNotVerified */ $block->getQty() ?>" type="text" size="4" pattern="^(0|[1-9][0-9]*)$" title="<?= $block->escapeHtml(__('Qty')) ?>" class="input-text qty" data-validate="{required:true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/>
require([ 'jquery', ], function($) { $('#form-validate .input-text.qty').on('change', function() { console.log('here'); $('#form-validate').submit(); }); });
Expected result (*)
Actual result (*)
at $.validator. (validation.js:541)
at $.validator.check (jquery.validate.js:556)
at $.validator.checkForm (jquery.validate.js:372)
at $.validator.form (jquery.validate.js:359)
at jQuery.fn.init.valid (jquery.validate.js:108)
at $...isValid (validation.js:1845)
at $...isValid (jquery-ui.js:402)
at HTMLFormElement. (jquery-ui.js:494)
at Function.each (jquery.js:370)
at jQuery.fn.init.each (jquery.js:137)
I fixed the problem with this solution :
in magento/lib/web/mage/validation.js line 538
replace :
/* eslint-enable max-len */ 'pattern': [ function (value, element, param) { return this.optional(element) || param.test(value); }, $.mage.__('Invalid format.') ],
by
/* eslint-enable max-len */ 'pattern': [ function (value, element, param) { return this.optional(element) || new RegExp(param).test(value); }, $.mage.__('Invalid format.') ],
I am doing a pull request for this.
The text was updated successfully, but these errors were encountered: