SP服务 [英] SP services
问题描述
你好
我在新表单上有以下代码来填充表单上的公司名称字段.但是,我想修改现有记录,如何使用sp服务修改当前代码.
I have the following code on the new form to populate the company name field on a form. However, I would like to modify the existing records, how do I modify the current code to do this using sp services.
<!-在Google CDN上引用jQuery->
< script type ="文本/javascript" src =" </script"> http://ajax.googleapis .com/ajax/libs/jquery/1.7.2/jquery.min.js></script >
<!-在cdnjs(Cloudflare)上参考SPServices->
< script type ="文本/javascript" src =" </script> ; http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js></script >
<!-- Reference jQuery on the Google CDN -->
<script type="text/javascript" src="</script">http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<!-- Reference SPServices on cdnjs (Cloudflare) -->
<script type="text/javascript" src="</script">http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
< script type ="文本/javascript">
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function() {
var thisUserAccount = $().SPServices.SPGetCurrentUser({
fieldName:名称",调试:false});
var thisUserAccount = $().SPServices.SPGetCurrentUser({
fieldName: "Name", debug: false});
$().SPServices({
操作:"GetUserProfileByName",
异步:false,
帐户名称:thisUserAccount,
completefunc:函数(xData,状态){
firstName = getUPValue(xData.responseXML,"FirstName");
office = getUPValue(xData.responseXML,"Office");
$().SPServices({
operation: "GetUserProfileByName",
async: false,
AccountName: thisUserAccount,
completefunc: function (xData, Status) {
firstName = getUPValue(xData.responseXML, "FirstName");
office = getUPValue(xData.responseXML, "Office");
//禁用公司名称"字段并设置值
$('input [title ='"Company Name"]').val(office);
$('input [title ="Company Name"]]).attr("readonly","true");
//Disable the Company Name field and set the value
$('input[title="Company Name"]').val(office);
$('input[title="Company Name"]').attr("readonly","true");
}
});
}
});
});
function getUPValue(x,p){
var thisValue = $(x).SPFilterNode("PropertyData").filter(function(){
返回$(this).find(名称").text()== p;
}).find(值").text();
返回thisValue;
}
function getUPValue(x, p) {
var thisValue = $(x).SPFilterNode("PropertyData").filter(function() {
return $(this).find("Name").text() == p;
}).find("Values").text();
return thisValue;
}
谢谢
Sherazad
推荐答案
Sherazad,
Hi Sherazad,
尝试下面的代码,并检查它是否对您有用:-
try below code and check whether it works for you:-
function get_user_profile_by_login(login){
function get_user_profile_by_login(login) {
var user = {};
var user = {};
var params = {
操作:"GetUserProfileByName",
异步:false,
completefunc:函数(xData,状态){
var params = {
operation: 'GetUserProfileByName',
async: false,
completefunc: function (xData, Status) {
(xData.responseXML).SPFilterNode("PropertyData").each(function(){
用户
(xData.responseXML).SPFilterNode("PropertyData").each(function() {
user
(this).find("Office").text()] =
(this).find("Office").text()] =
这篇关于SP服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!