根据引导字段输入预定义Javascript属性

时间:2018-06-13 19:56:31

标签: javascript jquery html twitter-bootstrap

我目前有一个表单文本框,该数据存储在SharePoint列表中。

我有'客户名称'存储在名为' API_ClientName':

的SharePoint列表中

form image

如何获取该客户端名称并在SharePoint列表的其他字段中预定义它?像这样:

  1. ACI_AccountName ------- AD ClientName
  2. ACI_Username --------- ad clientname
  3. ACI_FirstName -------- admin(始终保留此名称)
  4. ACI_LastName --------- admin(始终保留此名称)
  5. ACI_Email ---------- admin@AD.com(始终保留此电子邮件)
  6. 代码:

    
    
    function getItem() {
    	
    	var item = {
          Title: $("#ACI_client-name-input").val(), // Client Name
          ACI_Email: $("admin@AD.com").val(), // NOT SURE EMAIL IS CORRECTLY FORMATTED TO BE STATIC
          ACI_ClientName: $("      ").val(), // Account Name
    		  ACI_Username: $("   ").val(), // Username
    		  ACI_FirstName: $("   ").val(), // First Name
    		  ACI_LastName: $("   ").val(), // Last Name
    	};
    	return item;
    }
    
    function AddListItem(resources) {
    	
    	var item = getItem();
    	
    	$pnp.setup({
    		baseUrl: "url..."
    	});
      
    	$pnp.sp.web.lists.getByTitle("MailChimpIntake").items.add(item).then(function(r){
    		$("#submit").hide();
    		$("#cancel").hide();
    		
    		var newItem = r.data;
    		
    		window.location = 'url...';
    	});
    
    
    

    
    
    <div class="form-group row" style="margin-bottom: 15px;">
    	  <label for="ACI_client-name-input" class="col-lg-10 col-form-label">Client Name</label>
    	  <div class="col-lg-8">
    	    <input class="form-control" type="text" id="ACI_client-name-input" placeholder="" required>
    	  </div>
    	</div>
    &#13;
    &#13;
    &#13;

1 个答案:

答案 0 :(得分:0)

弄清楚了:

Title: $("#ACI_client-name-input").val(), 
// Client Name ACI_AccountName: "FH " + $("#ACI_client-name-input").val(), ACI_Username: "fh" + $("#ACI_client-name-input").val(), 
// Username ACI_FirstName: "....", 
// First Name ACI_LastName: "...", 
// Last Name ACI_Email: "....", 
// Email