This is my code for DOB on the registration form and its not working. It just displays a text box and not date picker.

 <?php $_dob = $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Dob') ?>
    <?php if ($_dob->isEnabled()): ?>
        <?php echo $_dob->setDate($block->getFormData()->getDob())->toHtml() ?>
    <?php endif ?>

What can be the issue?

  • Can you please share the error or the output of the code $block->getFormData()->getDob() .
    – KKR
    Aug 13 '19 at 6:18
  • @KKR it displays nothing, not the log displays any error
    – Nafsss
    Aug 13 '19 at 6:27
  • @RkRathod Yes it is enable and marked as optional
    – Nafsss
    Aug 13 '19 at 6:28
  • @RkRathod see it is displayed as a text box prnt.sc/orxrpo
    – Nafsss
    Aug 13 '19 at 6:32
  • check your custom code or custom module because in fresh setup work completely Aug 13 '19 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.