initial commit
This commit is contained in:
parent
d6ce6047ff
commit
eafb9e174e
|
@ -6,6 +6,8 @@
|
||||||
var field_id = $(this).attr('id').replace(/[\[\]']+/g, '_'); // Field id, the true one field
|
var field_id = $(this).attr('id').replace(/[\[\]']+/g, '_'); // Field id, the true one field
|
||||||
var object_type = $(this).attr('data-object-type');
|
var object_type = $(this).attr('data-object-type');
|
||||||
var query_args = $(this).attr('data-query-args');
|
var query_args = $(this).attr('data-query-args');
|
||||||
|
var idSelector = $(this).attr('data-id-element');
|
||||||
|
var idElement = idSelector === undefined ? undefined : $(idSelector);
|
||||||
|
|
||||||
$(this).devbridgeAutocomplete(Object.assign({
|
$(this).devbridgeAutocomplete(Object.assign({
|
||||||
serviceUrl: cmb_ajax_search.ajaxurl,
|
serviceUrl: cmb_ajax_search.ajaxurl,
|
||||||
|
@ -75,7 +77,12 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Singular
|
// Singular
|
||||||
$('input[name="' + field_name + '"]').val( suggestion.id ).change();
|
if (idElement !== undefined) {
|
||||||
|
$('input[name="' + field_name + '"]').val(suggestion.value).change();
|
||||||
|
idElement.val(suggestion.id);
|
||||||
|
} else {
|
||||||
|
$('input[name="' + field_name + '"]').val(suggestion.id).change();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue