Skip to content

Commit 70ee654

Browse files
author
Olga Nakonechna
committed
MAGETWO-45055: 'Admin' must be required field for the new Swatch
1 parent 22629ab commit 70ee654

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options */
1010
?>
11-
<fieldset class="fieldset ignore-validate">
11+
<fieldset class="fieldset">
1212
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Manage Options (values of your attribute)') ?></span></legend>
1313
<div id="manage-options-panel">
1414
<table class="admin__control-table">

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<tfoot>
3838
<tr>
3939
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>">
40-
<input type="hidden" class="required-swatch-entry"/>
40+
<input type="hidden" class="required-text-swatch-entry" name="text_swatch_validation"/>
4141
</th>
4242
</tr>
4343
<tr>

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<tfoot>
3434
<tr>
3535
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>">
36-
<input type="hidden" class="required-swatch-entry"/>
36+
<input type="hidden" class="required-visual-swatch-entry" name="visual_swatch_validation"/>
3737
</th>
3838
</tr>
3939
<tr>

lib/web/mage/validation.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,18 @@
12391239
},
12401240
'Please enter a valid number.'
12411241
],
1242-
'required-swatch-entry': [
1242+
'required-text-swatch-entry': [
1243+
function (value, element) {
1244+
var empty = $(element).closest('table')
1245+
.find('input.required-option:visible')
1246+
.filter(function(i, el){
1247+
return $.mage.isEmpty(el.value);
1248+
})
1249+
.length;
1250+
return empty === 0;
1251+
}, 'Swatch and Admin are the required fields in the each row.'
1252+
],
1253+
'required-visual-swatch-entry': [
12431254
function (value, element) {
12441255
var empty = $(element).closest('table')
12451256
.find('input.required-option:visible')

0 commit comments

Comments
 (0)