Fix label matching when copying answers (#4946)

This commit is contained in:
Richard Schreiber
2025-03-24 17:25:33 +01:00
committed by GitHub
parent 5375e22781
commit de9a86c614

View File

@@ -388,13 +388,13 @@ $(function () {
var source_label = get_label_text_for_id(source.id);
var $first_ticket_form = $(".questions-form").first().find("[data-addonidx=0]");
var $candidates = $first_ticket_form.find(source.tagName + ":not([type='checkbox'], [type='radio'])");
var $candidates = $first_ticket_form.find(source.tagName + ":not([type='checkbox'], [type='radio'], [type='hidden'])");
var $match = $candidates.filter(function() {
return (
this.id.endsWith(source.id.substring(3))
|| (this.placeholder && this.placeholder === source.placeholder)
|| (this.placeholder && this.placeholder === source_label)
|| (source_label && get_label_text_for_id(this.id) === source_label)
|| (source_label && this.id && get_label_text_for_id(this.id) === source_label)
);
}).first();
$match.val(this.value).trigger("change");