Fixed quotes were not escaped properly for contains search in dropdowns (fixes #249)

This commit is contained in:
Bernd Bestel
2019-05-16 22:20:01 +02:00
parent 8f9c3c66f7
commit 0a4ea6861a
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ $('.user-combobox').combobox({
var prefillUser = Grocy.Components.UserPicker.GetPicker().parent().data('prefill-by-username').toString();
if (typeof prefillUser !== "undefined")
{
var possibleOptionElement = $("#user_id option[data-additional-searchdata*='" + prefillUser + "']").first();
var possibleOptionElement = $("#user_id option[data-additional-searchdata*='" + prefillUser.replace("'", "\\'") + "']").first();
if (possibleOptionElement.length === 0)
{
possibleOptionElement = $("#user_id option:contains('" + prefillUser + "')").first();