Friday, June 26, 2015

SharePoint custom list form with custom attach file button

I had a requirement where user wanted to attach a file to list item. Well, that's normal thing for user and easy too but they do not want to click the "Action file" button at Ribbon.

User wanted a button on list form to attach a file !!!!!!!!!!!

Being a master in jQuery, I thought I would be able to grab the click function and assign it to custom button. I was trying trying trying..... > <  Uuh ! No use with several tricks performed. 

Later I came across a SharePoint javascript function "UploadAttachment()". Boooooooom ! It's done.
Very easy solution. 

<input type="button" value="Click here to attach" onclick='UploadAttachment()'></input>

Custom list form: