Skip to content

Commit 13b1119

Browse files
author
Volodymyr Zaets
committed
MAGETWO-48535: No js validation for date of birth attribute on storefront
1 parent 989af63 commit 13b1119

File tree

1 file changed

+21
-1
lines changed
  • app/code/Magento/Customer/Block/Widget

1 file changed

+21
-1
lines changed

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function getLabel()
175175
public function getFieldHtml()
176176
{
177177
$this->dateElement->setData([
178-
'extra_params' => $this->isRequired() ? 'data-validate="{required:true}"' : '',
178+
'extra_params' => $this->getHtmlExtraParams(),
179179
'name' => $this->getHtmlId(),
180180
'id' => $this->getHtmlId(),
181181
'class' => $this->getHtmlClass(),
@@ -201,6 +201,26 @@ public function getHtmlId()
201201
return 'dob';
202202
}
203203

204+
/**
205+
* Return id
206+
*
207+
* @return string
208+
*/
209+
public function getHtmlExtraParams()
210+
{
211+
$extraParams = array(
212+
"'validate-date-au':true"
213+
);
214+
215+
if ($this->isRequired()) {
216+
array_push($extraParams, 'required:true');
217+
}
218+
219+
$extraParams = implode(', ', $extraParams);
220+
221+
return 'data-validate="{' . $extraParams . '}"';
222+
}
223+
204224
/**
205225
* Returns format which will be applied for DOB in javascript
206226
*

0 commit comments

Comments
 (0)