Skip to content

Commit

Permalink
MAGETWO-47240: [GitHub]JavaScript Error on Checkout Page after Changi…
Browse files Browse the repository at this point in the history
…ng Country in Estimate Shipping and Tax Block
  • Loading branch information
omiroshnichenko committed Jul 20, 2016
1 parent 5eb1602 commit 7fb8a9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
value="<?php echo $block->escapeHtml($block->getStreetLine(1)) ?>"
title="<?php /* @escapeNotVerified */ echo __('Street Address') ?>"
id="street_1"
class="input-text <?php /* @escapeNotVerified */
echo $_streetValidationClass ?>"/>
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>"/>
<div class="nested">
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
<?php for ($_i = 1, $_n = $this->helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i < $_n; $_i++): ?>
Expand All @@ -88,7 +87,8 @@
<input type="text" name="street[]"
value="<?php echo $block->escapeHtml($block->getStreetLine($_i + 1)) ?>"
title="<?php /* @escapeNotVerified */ echo __('Street Address %1', $_i + 1) ?>"
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>" echo $_streetValidationClass ?>">
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>"
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>">
</div>
</div>
<?php endfor; ?>
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ define([
return _.mapObject({
"min_text_length": [
function (value, params) {
return value.length == 0 || value.length >= +params;
return _.isUndefined(value) || value.length == 0 || value.length >= +params;
},
$.mage.__('Please enter more or equal than {0} symbols.')
],
"max_text_length": [
function (value, params) {
return value.length <= +params;
return !_.isUndefined(value) && value.length <= +params;
},
$.mage.__('Please enter less or equal than {0} symbols.')
],
Expand Down

5 comments on commit 7fb8a9c

@UltimateDesignSlayer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You guys saved my life.

@hanhpv
Copy link

@hanhpv hanhpv commented on 7fb8a9c Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not working if the value is null

@tymur-yunusov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not working if the value is null

have you found a solution to make it work if value is null? im still having same problem with turned on js bundle (EE ver. 2.2.5)

@JeffersonTeixeira
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not:
return value !=null && value.length <= +params;
?

I'm still getting error (Chrome (I wrote Chrome because others navigators describes it different)):

Uncaught TypeError: Cannot read property 'length' of null

@sandeep570
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also getting the same issue if the value is null and is there any solution ??

Please sign in to comment.