我是這個社區的新手,在過去的48個小時裏,我一直在尋找關於這個問題的答案。JQuery Autocomplete Sharepoint 2013和Infopath,只能工作一次
我在Infopath Designer 2013中創建了一個窗體。此外,我使用的是SPD 2013,我試圖完成的是使用SPServices將幾個字段綁定到Jquery Autocomplete以創建數據向量。
我得到這個工作,但它只能工作一次。我在SharePoint內創建了一個頁面,其中包括在InfoPath Web部件,也是一個內容編輯器Web部件使用腳本片段包含:
<script type="text/javascript" src="../jquery-ui-1.11.4.custom/external/jquery/jquery.js"></script>
<script type="text/javascript" src="../jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
<script type="text/javascript" src="../Scripts/jquery.SPServices.js"></script>
<script type="text/javascript" src="../Scripts/OpenCaseFormAutocomplete.js"></script>
我的文件腳本OpenCaseFormAutocomplete:
Sys.Application.add_load(function() {
$(document).ready(readyCall);
function readyCall(){
var externalParties1 = [];
var externalParties2 = [];
$().SPServices({
operation: "GetListItems",
listName: "Autocomplete_Customer",
CAMLViewFields: "",
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
externalParties1.push($(this).attr("ows_Title"));
});
}
});
$().SPServices({
operation: "GetListItems",
listName: "Autocomplete_End-User",
CAMLViewFields: "",
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
externalParties2.push($(this).attr("ows_Title"));
});
}
});
$("input[id$='FormControl0_V1_I1_T3']").autocomplete({
source: externalParties1,
minLength: 3
});
$("input[id$='FormControl0_V1_I1_T4']").autocomplete({
source: externalParties2,
minLength: 3
});
\t
\t
} \t
});
/*
我在某處讀到了那裏我這是回發問題。但我似乎沒有得到這個代碼在第一次後工作。第二個表單運行回發調用,它從輸入中清除附加的自動完成。
是否有修復這個,我應該把代碼,以避免失去綁定或重新綁定代碼的替代?
您是否嘗試過移動'$( 「輸入[ID $ = 'FormControl0_V1_I1_T3']」)autocomplete'代碼中。 $()的'completeFunc'。SPServices'有最後一行嗎? – Max