Normally SharePoint provides Document Attachment in the ribbon. But in my case ribbon was hide from the user. So I need to add Attachment Control on the form instead of ribbon. So I achieve it using Client Object Model. Insert the following code in your form to make attachment field available in the Form.
<tr>
<td rowspan="2" width="190px" valign="top" height="50px">
<H3>
Upload Evidence
</H3>
</td>
<td valign="bottom" height="15" id="attachmentsOnClient">
<span dir="ltr">
<input type="file" name="fileupload0" id="onetidIOFile" size="56" title="Name" />
</span>
</td>
</tr>
<tr>
<td colspan="4">
<input id="attachOKbutton" type="BUTTON" onclick='OkAttach()' value="Upload" style="width: 12.8em; height: 2em"/>
<span id="idSpace"/>
</td>
</tr>
I press ok but nothing happens, do u have any idea what should i do?
ReplyDeleteWhat do you mean by list page?
ReplyDeleteAll what I did is as follows:
1-created a custom list.
2-Openned sharepoint designer and created a new "newform" page.
3- Added the above code to the newform aspx page.
4- saved.
5-Openned "new item" from the list (In sharepoint browser).
the new form page is displayed with the new added upload control.
6-I selected an item to attach, and pressed "ok"....nothing happens:(
Hi Noha,
ReplyDeleteYou are going absolutely fine. Could you please mention which SharePoint version you are using? I have tested this code with SharePoint 2010. Please also check if there is any JavaScript error occur in Browser console.