Don't select any options and click "Add to cart"
Message "This is a required field." should display below options.
Message "This is a required field." displays at the bottom of form.
Thanks for reporting. Internal ticket MAGETWO-55042 was created.
that is good, but when will get it resolved? so I need to stop using M2.1 in production because of this issue.
I have resolve this issue.
...pub\static\frontend\Magento...\en_US\Magento_Swatches\js\swatch-renderer.js
if ($widget.productForm) {
$widget.productForm.append(input);
input = '';
}
$widget.productForm.append(input); -> container.append(input);
if ($widget.productForm) {
container.append(input);
input = '';
}
now validation message will be display below options
Will this be resolved in the next release?
Thanks,
@parthviroja was on the right track however you don't want to modify a pub/static file since it will be overwritten with each deploy.
In order to fix this you have to override the JavaScript for a Magento Core module. /vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js
<theme_dir>/Magento_Swatches/web/js/swatch-renderer.js
vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js
into the newly created fileif ($widget.productForm) {
$widget.productForm.append(input);
input = '';
}
to
if ($widget.productForm) {
container.append(input);
input = '';
}
// Create new control
container.append(
'<div class="' + classes.attributeClass + ' ' + item.code +
'" attribute-code="' + item.code +
'" attribute-id="' + item.id + '">' +
label +
'<div class="' + classes.attributeOptionsWrapper + ' clearfix">' +
options + select +
'</div>' + input +
'</div>'
);
Issue is fixed and delivered into mainline
https://github.com/magento/magento2/commit/51bc865
If you still have it after upgrade, please reopen
@tkacheva I upgraded to Magento 2.1.2 still having this issue.
same
@seavenger @Dublerq The fix isn't in 2.1.2 yet, will be in 2.2 (or in 2.1.3 but don't get your hopes up).
Still in 2.1.2.
Same problem 2.1.3.;-(
Delivering fix into mainline means that fix is in develop brunch (2.2 currently)
It will be included in upcoming patch release
I turned the relevant parts of the fix into a module (I ignored the aria stuff). requiredFields-magento2. It appears to work just fine in isolation. I only tested in 2.1.3 YMMV.
When we get the integrated fix just remove the module.
Hi,
Those who still have this problem i created a custom snippet that resolves this issue:
Just include it in one of your templates:
`
`
No core functionality is rewritten, when they relese the fix, just remove this snippet.
Regards
@ksz2013's workaround appears to be working for me. Might be a good band aid for others affected.
Thanks!
@tkacheva Which version of Magento will this fix be included in?
Thanks @ksz2013 your wa worked like a charm!
This is still an issue in 2.1.5.
Thanks @ksz2013. It work for me
Most helpful comment
Hi,
Those who still have this problem i created a custom snippet that resolves this issue:
Just include it in one of your templates:
`
`No core functionality is rewritten, when they relese the fix, just remove this snippet.
Regards