问题描述
我有一项任务,我需要在表单中具有多个附件字段才能提交数据.我可以在一个附件字段中附加多个文件.我知道在SharePoint自定义列表中以及何时没有多个附件字段是不可能的 我将附件复制到表单的多个部分,使其仅显示重复的附件.
I have a task that I need to have multiple attachment fields in a form to submit data. I am able to attach multiple files at with the one attachment field. I know that Its not possible to have multiple attachment fields in SharePoint custom list and when I copy the attachment to multiple sections of the form it only show duplicated attachments .
我只是想知道是否可以使用一种脚本来分别标识附件中不同部分中的上载数据?如果没有,您能推荐我至少确定不同部分附加的内容吗? 的形式?
I was just wondering is there a way where I could have a script to separately identify the uploaded data in attachment field in different sections? If not, could you recommend me what I could do to at least identify what has been attached in different section of a form?
在此先感谢
推荐答案
如果要创建一个具有多个附件的字段,我们可以使用JSOM和Rest API来实现,这是一个详细的代码演示,供您参考:
If want to make a field with multiple attachments, we can use JSOM and Rest API to achieve it, here is a detailed code demo for your reference:
HTML:
<script type="text/javascript" src="/Script/jquery-1.10.2.js"></script>
<script type="text/javascript" src="/Script/jquery-ui.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/Script/jquery.multifile.js"></script>
<span style="font-size: 22.0pt;padding-left:20px">Personal Details<o:p></o:p></span>
<table align="left" border="1" cellpadding="0" cellspacing="0" width="0" id="mytable">
<tbody>
<tr>
<td >
<table align="left" border="1" cellpadding="0" cellspacing="0" ><tbody><tr><td valign="top"><h3> Name</h3></td>
<td valign="top" style="padding:9px;">
<input type="text" value="" maxlength="255" id="Name" title="Name" style="width: 96%;" ms-spellcheck-true">
</td></tr><tr >
<td><h3> Address</h3> </td><td>
<input type="text" value="" maxlength="255" id=" Address" title="Address" style="ime-mode :;width: 96%;" ms-spellcheck-true"></td></tr><tr><td><h3 >City</h3></td>
<td><input type="text" value="" maxlength="255" id=" City " title=" City " style=";width: 96%;" ms-spellcheck-true"></td></tr><tr><td><h3 >
Contact Number </h3></td>
<td><input type="text" value="" maxlength="255" id=" ContactNumber " title="ContactNumber" style="ime-mode :;width: 96%;" ms-spellcheck-true"></td></tr></tbody></table><table ><tbody>
<tr ><td ><span style="font-family: " segoe ui" ,sans-serif; color: #444444">Click here to attach file</span> <div id="attachFilesHolder ">
<input id="file_input" type="file" name="files[]">
</div>
</td><td></td></tr></tbody></table>
<div style="TEXT-ALIGN: -webkit-center; padding-bottom: 20px; padding-top: 20px; padding-left:190px"><input name="SaveItem" style=" height: 40px; font-size: 15px;" id=" NewSaveItem " accesskey="O" onclick="" type="button" value="Click here to submit " target="_self"></div>
</tbody></table>
JavaScript:
JavaScript:
<script type="text/javascript">
var oLoader;
var attcount = 0;
var arraycount = 0;
这篇关于多个附件字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!