silverstripe-dms/javascript/DMSDocumentAddExistingField.js

17 lines
499 B
JavaScript
Raw Normal View History

2012-08-07 03:44:42 +02:00
(function($) {
$('.document-add-existing .document-autocomplete').entwine({
onmatch: function() {
$(this).autocomplete({
source: 'admin/pages/adddocument/documentautocomplete',
select: function(event, ui) {
if(ui.item) {
var page_id = $(this).closest('form').find(':input[name=ID]').val();
var document_id = ui.item.value;
jQuery.ajax('admin/pages/adddocument/linkdocument?ID=' + page_id + '&documentID=' + document_id);
}
}
2012-08-07 03:44:42 +02:00
});
}
});
}(jQuery));