Magento 2 - пользовательское сообщение об ошибке проверки jQuery


У меня есть следующие входные данные, которые требуют проверки. При сбое метода remote отображается сообщение об ошибке Please fix this field.. Как я могу настроить это сообщение?

<input type="text" data-validate="{required:true, email:true, remote:'/bonus-point/transfer/validateRecipientEmail'}" class="input-text" title="Recipient Email" value="" id="recipient_email" name="recipient_email" aria-required="true">
Author: Paul, 2016-09-03

1 answers

Есть способ вернуть пользовательское сообщение об ошибке в json

public function execute() {
    $resultJson = $this->resultJsonFactory->create();
    $message = $this->getRequest()->getParam('message');
    if (strlen($message) < 3) { 
        $resultJson->setData('Message too short'); // error
    } else {
        $resultJson->setData('true'); // success
    }
    return $resultJson;
}
 0
Author: Paul, 2016-09-17 07:01:00