Open
Description
Preconditions and environment
- Magento version: 2.4.6
- Custom date field in any frontend form
Steps to reproduce
- Add custom date field with date button in frontend form.
- Open form which have custom date field.
- Try to submit blank form.
- All field show validation message as per there validation but date field not show any validation message
You can add custom date form field without calendar button using following code snippets,
<div class="field required">
<label for="establishment_date" class="label">
<span><?= /* @noEscape */ $block->escapeHtml(__('Establishment Date')) ?></span>
</label>
<div class="control">
<input type="text"
name="establishment_date"
value=""
title="<?= /* @noEscape */ $block->escapeHtml(__('Establishment Date')) ?>"
class="input-text required-entry"
id="establishment_date">
</div>
</div>
<script type="text/javascript">
require([
'jquery',
'mage/calendar'
], function ($) {
$("#establishment_date").datepicker({
dateFormat:'dd-mm-yy',
changeYear: true,
changeMonth: true,
});
});
</script>
Expected result
Date form field should show validation message same as other fields
Actual result
Date field not showing validation message without calendar button
Additional information
- It is working fine when we add calendar button with date form field.
- Date field validation is added after calendar button so, when we don't add button so, validation message is not showing. We can add button using following code snippet but it should work without button too.
<script type="text/javascript">
require([
'jquery',
'mage/calendar'
], function ($) {
$("#establishment_date").datepicker({
dateFormat:'dd-mm-yy',
changeYear: true,
changeMonth: true,
buttonText: '',
showOn: 'both'
});
});
</script>
Error message is placed after button for date field from validation.js
https://github.com/magento/magento2/blob/2.4-develop/lib/web/mage/validation.js#L1880-L1883
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedMay be fixed according to the position in the backlog.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchIssue related to Developer Experience and needs help with Triage to Confirm or Reject it