Topic: Add required to datepicker
I would like to make a datepicker input field required but I don't seem to be able to get it right.
And then added the
editable:trueinside the initialization together with the
required attribute on the element.
However, the datepicker modal no longer opens on click after that. Any suggestions for a fix?
Jakub Strebeyko staff answered 5 years ago
Hi there library_manager,
As you surely see, the "Please fill out this field"
tooltip popping up is a plain, HTML5-style validation applied through the
required attribute. To have this kind of validation working, the
Date Picker must first become a regular, HTML5-recognizable
input field (which is done by passing in the
editable: true option). And so, clicking onto it can no longer trigger the date-picking popover, but enables "manual" edits of the field instead.
To have both the MDB
Date Picker and validation it's worth to consider creation of a custom validating function on submit or using some widely recognized plugins, like
With Best Regards,
andreaHandlebars free answered 4 years ago
Hi that plugin https://jqueryvalidation.org doesn't work, because there's a conflic with internal mdbootstrap's validator. Can you help me?
Piotr Glejzer staff commented 4 years ago
Hi, do you have some console errors to show?
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: Yes
- Provided link: Yes