Topic: Date Picker Validation

alex9249 pro asked 6 years ago


What is the best way to get the data-error text to be correctly shown below the datepicker input? I get the red line when no selection is made, but i cannot get the error text to be shown. Also after it gets the invalid class added during validation, and then i select a date the red line still appears.  I tried using the built in onSet function to remove the invalid class but it didn't appear to work. <div class="md-form"> <input type="text" id="pickupStartDate" placeholder="Select a date" class="form-control datepicker validate dateselector" > <label for="pickupStartDate" data-error="Cannot be blank" data-success="" class="active">Pickup Start Date</label> </div>

Jakub Strebeyko staff answered 6 years ago


Hi there Alex, Thanks for reaching out! Label's data-error property holds the error message being displayed once the <input> element associated with it get the .invalid class - the message is attached to DOM through :after pseudo-selector. There seems to be bug when it comes to DatePicker validation, as its label's data-error attribute does not follow this rule. It is scheduled to be fixed as soon as MDB 4.5.1 release. With Best Regards, Kuba

alex9249 pro commented 6 years ago

Thanks Kuba!


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags