Title: Invalid data allowed?
Last modified: December 12, 2023

---

# Invalid data allowed?

 *  [1968phillip](https://wordpress.org/support/users/1968phillip/)
 * (@1968phillip)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/invalid-data-allowed/)
 * Hi
 * If a user enters invalid text into the datetimepicker and either clicks or tabs
   away, there is no action taken. If the user then clicks back on the datetimepicker(
   or tabs to it), on focus the invalid text is changed to the current datetime,
   or a valid datetime if one can be interpreted from the entered text. It is a 
   requirement that my users be able to manually enter a date/time, so how can I
   enforce the sort of validation that occurs on focus?
 * A further, sort of related question :- if I wish to set the value of the datetimepicker
   field programmatically from JS or JQuery, how can I trigger a validation check
   of the data? I have tried by setting focus to the field, which works however 
   it leaves the popup open.
    -  This topic was modified 2 years, 3 months ago by [1968phillip](https://wordpress.org/support/users/1968phillip/).

Viewing 1 replies (of 1 total)

 *  [niel.o](https://wordpress.org/support/users/nielorit/)
 * (@nielorit)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/invalid-data-allowed/#post-17273299)
 * Hey [@1968phillip](https://wordpress.org/support/users/1968phillip/)
 * Consider switching to a dropdown for date selection instead of text field .
 * For setting values programmatically and closing the popup, you can use the hide
   method something like $datetimepicker.datepicker(“hide”);
 * That method is used to close the popup after setting the value.
 * Best,

Viewing 1 replies (of 1 total)

The topic ‘Invalid data allowed?’ is closed to new replies.

 * ![](https://ps.w.org/date-time-picker-field/assets/icon.svg?rev=2964043)
 * [Availability Datepicker – Booking Calendar for Contact Form 7 – Input WP](https://wordpress.org/plugins/date-time-picker-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/date-time-picker-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/date-time-picker-field/)
 * [Active Topics](https://wordpress.org/support/plugin/date-time-picker-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/date-time-picker-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/date-time-picker-field/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 1 reply
 * 2 participants
 * Last reply from: [niel.o](https://wordpress.org/support/users/nielorit/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/invalid-data-allowed/#post-17273299)
 * Status: not resolved