ECMaScript 之添加数据

function EntryVoteData()
 {
      if(VerificationData()==true){
			      var Name=$("div[id$='_txt_Name_upLevelDiv']").text();
			      var peoplePickerData = getPeoplePickerDataDocument();
			      var userId = getXmlValue(peoplePickerData, "/ArrayOfDictionaryEntry/DictionaryEntry[./Key = 'SPUserID']/Value");
			      var Part=$("#txt_Part").val();
			      var Tel=$("#txt_Tel").val();
			      var Other=$("#txt_Other").val();
			      var ActivityID=$("#td_IDInfo").text();
			   try {
			             var context = new SP.ClientContext.get_current();
			             var web = context.get_web();
			             var list = web.get_lists().getByTitle($("#div_TeamActivityLibName").text());
			             var listItemCreationInfo = new SP.ListItemCreationInformation();
			             var newItem = list.addItem(listItemCreationInfo);
			            // var newLookupField = new SP.FieldLookupValue();
			            // newLookupField.set_lookupId(ActivityID) 
			             newItem.set_item('Title', Name+"111"); 
			             newItem.set_item('_x56e2__x961f___ID', ActivityID); 
			             newItem.set_item('_x5907__x6ce8__x4_', Other);
			             newItem.set_item('_x62a5__x540d___', parseInt(userId) );
			             newItem.set_item('_x62a5__x540d__x4eb0e8__x95', Part); 
			             newItem.set_item('_x8054__x8bdd_', Tel); 
			            newItem.update();
			            context.executeQueryAsync(Function.createDelegate(this, this.addVotesuccess),
			                                      Function.createDelegate(this, this.addVotefailed));
			        } 
			        catch (e) 
			        { 
			          alert('失败:'+e.Message); 
			        }
		}
  }
  function addVotesuccess() { alert('成功!');$("div[id$='div_Count']").text('1'); ClearData();}
  function addVotefailed(sender, args) {alert('失败 消息:' + args.get_message());}

 

转载于:https://www.cnblogs.com/TNSSTAR/archive/2013/01/09/2852920.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值