forked from CGM_Public/pretix_original
Fix html-based form errors not being scrolled to in iOS/Safari (#5448)
This commit is contained in:
committed by
GitHub
parent
9401fbb1bc
commit
e34a3ab2ce
@@ -225,6 +225,16 @@ var form_handlers = function (el) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function setup_basics(el) {
|
function setup_basics(el) {
|
||||||
|
el.find("form").attr("novalidate", true).on("submit", function (e) {
|
||||||
|
if (!this.checkValidity()) {
|
||||||
|
var input = this.querySelector(":invalid:not(fieldset)");
|
||||||
|
(input.labels[0] || input).scrollIntoView();
|
||||||
|
// only use reportValidity, which usually sets focus on element
|
||||||
|
// input.focus() opens dropdowns, which is not what we want
|
||||||
|
input.reportValidity();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
el.find("input[data-toggle=radiocollapse]").change(function () {
|
el.find("input[data-toggle=radiocollapse]").change(function () {
|
||||||
$($(this).attr("data-parent")).find(".collapse.in").collapse('hide');
|
$($(this).attr("data-parent")).find(".collapse.in").collapse('hide');
|
||||||
$($(this).attr("data-target")).collapse('show');
|
$($(this).attr("data-target")).collapse('show');
|
||||||
|
|||||||
Reference in New Issue
Block a user