Last modified: 2011-03-13 18:06:37 UTC
I have a couple of 'input type=datetimepicker' fields in forms - they all have in common, that just entering a time is inacceptable - there can be just a date and no time, or both filled in, but not just a time. datetimepicker happily accepts that though, and saves 'TemplateParameter= hh:mm' (hh:mm being the time entered) when I submit the form. Would it be possible to somehow disallow entering just a time with datetimepicker, or at least warn the user?
There is nothing like dateonly or datemandatory. You can set the whole input to mandatory, but that would require both date and time field to be set, i.e. it is not possible to leave the time field empty. You could also combine the datetimepicker with a regexp input.
(In reply to comment #1) > You could also combine the datetimepicker with a regexp input. Thanks for bringing the regexp input to my attention, it's awesome! The following field definition solves my problem: {{{field|Deadline|input type=regexp|base type=datetimepicker|regexp=/^\s?\d\d:\d\d\s?$/|inverse|message=You can either choose a date and a time, or just a date, but not a time alone.}}}