mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Tabs: Do not hide HTMl5 validation
This commit is contained in:
@@ -9,6 +9,7 @@ $(function () {
|
||||
|
||||
var i = 0;
|
||||
var preselect = null;
|
||||
var validity_error = false;
|
||||
$form.find("fieldset").each(function () {
|
||||
var $fieldset = $(this);
|
||||
var tid = "tab-" + j + "-" + i;
|
||||
@@ -25,6 +26,16 @@ $(function () {
|
||||
preselect = i;
|
||||
}
|
||||
}
|
||||
$fieldset.find("input, select, textarea").on("invalid", function () {
|
||||
if ($tablink.find(".fa-warning").length === 0) {
|
||||
$tablink.append(" ");
|
||||
$tablink.append($("<span>").addClass("fa fa-warning text-danger"));
|
||||
if (!validity_error) {
|
||||
validity_error = true;
|
||||
$tablink.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
$fieldset.find("legend").remove();
|
||||
$fieldset.addClass("tab-pane").attr("id", tid);
|
||||
if (location.hash && ($fieldset.find(location.hash).length || location.hash === "#" + tid + "-open") && preselect === null) {
|
||||
@@ -36,6 +47,9 @@ $(function () {
|
||||
$tabs.find("a").on('shown.bs.tab', function (e) {
|
||||
history.replaceState(null, null, e.target.getAttribute("href") + "-open");
|
||||
});
|
||||
$form.closest("form").on("submit", function () {
|
||||
validity_error = false;
|
||||
});
|
||||
j++;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user