mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Add min/max validation for date, datetime, and number questions (#1858)
This commit is contained in:
@@ -113,6 +113,14 @@ var form_handlers = function (el) {
|
||||
close: 'fa fa-remove'
|
||||
},
|
||||
};
|
||||
if ($(this).is('[data-min]')) {
|
||||
opts["minDate"] = $(this).attr("data-min");
|
||||
opts["viewDate"] = $(this).attr("data-min");
|
||||
}
|
||||
if ($(this).is('[data-max]')) {
|
||||
opts["maxDate"] = $(this).attr("data-max");
|
||||
opts["viewDate"] = $(this).attr("data-max");
|
||||
}
|
||||
if ($(this).is('[data-is-payment-date]'))
|
||||
opts["daysOfWeekDisabled"] = JSON.parse($("body").attr("data-payment-weekdays-disabled"));
|
||||
$(this).datetimepicker(opts);
|
||||
|
||||
@@ -102,6 +102,10 @@ $(function () {
|
||||
var show = $("#id_type").val() == "C" || $("#id_type").val() == "M";
|
||||
$("#answer-options").toggle(show);
|
||||
|
||||
$("#valid-date").toggle($("#id_type").val() == "D");
|
||||
$("#valid-datetime").toggle($("#id_type").val() == "W");
|
||||
$("#valid-number").toggle($("#id_type").val() == "N");
|
||||
|
||||
show = $("#id_type").val() == "B" && $("#id_required").prop("checked");
|
||||
$(".alert-required-boolean").toggle(show);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user