mirror of
https://github.com/pretix/pretix.git
synced 2026-08-12 11:07:02 +00:00
add trigger change to fix e.g. country-state-refresh
This commit is contained in:
@@ -385,7 +385,7 @@ $(function () {
|
||||
" #id_city, #id_country, #id_state").change(function () {
|
||||
if (copy_to_first_ticket) {
|
||||
var $first_ticket_form = $(".questions-form").first().find("[data-addonidx=0]");
|
||||
$first_ticket_form.find("[id$=" + this.id.substring(3) + "]").val(this.value);
|
||||
$first_ticket_form.find("[id$=" + this.id.substring(3) + "]").val(this.value).trigger("change");
|
||||
|
||||
// when matching by placeholder or label, make sure to always match the tagName of the element
|
||||
// filter any checkbox/radio inputs as copied input is either select or type=email|text, but could be
|
||||
@@ -394,21 +394,21 @@ $(function () {
|
||||
if (this.placeholder) {
|
||||
$first_ticket_form.find(
|
||||
selectorPrefix + "[placeholder='" + CSS.escape(this.placeholder) + "']"
|
||||
).val(this.value);
|
||||
).val(this.value).trigger("change");
|
||||
}
|
||||
var label = $("label[for=" + this.id +"]").first().contents().filter(function () {
|
||||
return this.nodeType != Node.ELEMENT_NODE || !this.classList.contains("sr-only");
|
||||
}).text().trim();
|
||||
if (label) {
|
||||
// match to placeholder and label
|
||||
$first_ticket_form.find(selectorPrefix + "[placeholder='" + CSS.escape(label) + "']").val(this.value);
|
||||
$first_ticket_form.find(selectorPrefix + "[placeholder='" + CSS.escape(label) + "']").val(this.value).trigger("change");
|
||||
var v = this.value;
|
||||
$first_ticket_form.find("label").each(function() {
|
||||
var text = $(this).first().contents().filter(function () {
|
||||
return this.nodeType != Node.ELEMENT_NODE || !this.classList.contains("sr-only");
|
||||
}).text().trim();
|
||||
if (text == label) {
|
||||
$(selectorPrefix + "#" + this.getAttribute("for")).val(v);
|
||||
$(selectorPrefix + "#" + this.getAttribute("for")).val(v).trigger("change");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user