I am trying to limit number of allowed characters on Firstname input field in my payment methods on Review & Payments area. I am using the magento default check/money order
payment method.
Basically this is the area that customers can indicate that their billing address is different from their shipping address.
To achieve this, I am extending Layoutprocessor.php
file in my custom module.
I have tried the following code, but it seems it is not working.
<?php
namespace MY_MODULE\Block\Checkout;
class LayoutProcessor extends \Magento\Framework\View\Element\AbstractBlock implements \Magento\Checkout\Block\Checkout\LayoutProcessorInterface
{
public function process($jsLayout) {
$jsLayout['components']
['checkout']['children']
['steps']['children']
['billing-step']['children']
['payment']['children']
['payments-list']['children']
['checkmo-form']['children']
['form-fields']['children']
['firstname']['max_text_length'] = 15;
return $jsLayout;
}
}
the max_text_length
is available in the following file.
magento2-2.1.6/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js
.
https://github.com/magento/magento2/blob/2.1.6/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js#L56
I am using Magento 2.1.6 version.Please let me know if anyone knows a fix for it.