【发布时间】:2017-05-01 03:34:42
【问题描述】:
我是这个社区的新手,在过去的 48 小时搜索和尝试中,我一直在寻找这个问题的答案。
我在 Infopath Designer 2013 中创建了一个表单。此外,我正在使用 SPD 2013,我想要完成的是使用 SPServices 将几个字段绑定到 Jquery Autocomplete 以创建数据向量。
我得到了这个工作,但它只工作一次。我在 Sharepoint 中创建了一个页面,并包含了 Infopath Webpart,它也是一个内容编辑器 Web 部件,其中包含一个脚本 sn-p,其中包含:
<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
});
}
});
/*
我在某处读到回发存在问题。但我似乎没有让这段代码在第一次之后工作。表单运行回发调用的第二次,它会从输入中清除附加的自动完成功能。
是否有解决此问题的方法,我应该将代码放置在一个位置以避免丢失绑定或重新绑定代码替代方案?
【问题讨论】:
-
您是否尝试将
$().SPServices的completeFunc中的$("input[id$='FormControl0_V1_I1_T3']").autocomplete代码移动到最后一行?
标签: sharepoint sharepoint-2013 jquery-ui-autocomplete infopath spservices