Topic: Datepicker validation not firing after first snippet / page refresh

magikweb priority asked 5 years ago


Expected behavior

We expect to see an error message (validation message) after clicking "Soumettre" below the datepicker field (Date de naissance).

Actual behavior

No message is shown on that particular field.

Resources (screenshots, code snippets etc.)

Warning: Upon opening the snippet, the validation seems to work. After a first refresh (type a character in the HTML box and remove it), it stops working and acts as it does on our website.

See the datepicker field:

No validation

View the form: Sign-up example

Are you able to tell if it's our code or if it's a bug?

Thank you very much! MDB is real great so far.


Mikołaj Smoleński staff commented 5 years ago

Hi there, we've just tested Your snippet but we can't see the issue. Which input is causing the problem?

Best!


magikweb priority commented 5 years ago

You are correct, the snippet doesn't generate the issue anymore since the validation (red Xs) doesn't work at all. I edited the post to provide a link to the target page since it's a public one and the issue is 100% client-side. Hopefully, it's useful while I fiddle the snippet in the next few hours / days. The target field is "birthday"/"date de naissance" (datepicker).


Mikołaj Smoleński staff commented 5 years ago

Please let me know here when the snippet will be ready. Best regards!


magikweb priority commented 5 years ago

We're not used to snippets and can't seem to get the snippet to work as the website does. It simply won't trigger the JS Submit which would add the validation error messages next to the fields (except for the birthday which is the problem). If the screenshot and the website URL doesn't provide usable information, we will retry fiddling with the snippet to make it work soonishly.


magikweb priority answered 5 years ago


We found the issue! All we had to do is add .removeAttr('readonly'); to the initialization as described (somewhere) in the documentation.

jQuery('.datepicker').removeAttr('readonly');


Mikołaj Smoleński staff commented 5 years ago

I'm glad to read it. Thanks for cooperation. Best regards


FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.7.5
  • Device: PC
  • Browser: Chrome
  • OS: Win 10
  • Provided sample code: No
  • Provided link: Yes
Tags