RE: Using ink sketch control in a SharePoint form to place markings on an image from Tablets, iPad, or PC

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

31 Jul 2017

This blog post about adding ink notes to a picture is perfect for a form we need to create but I am wondering if it can be modified to use the attachment to a list item instead of storing a separately uploaded file.

Using ink sketch control in a SharePoint form to place markings on an image from Tablets, iPad, or PC

I have looked at the document on Getting and setting SharePoint form field values but it doesn't mention how to get a url for an attached file. I know I have done something like this before with Forms Designer in order to display attached image files on an expense report, however, that was at a previous job so I no longer have access to how I did it.

This would have been about three years ago, and I am sure that Dmitry Kozlov was the one who helped me with it.
City of Nampa
Idaho
United States of America

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

01 Aug 2017

Hello!
You can use this code on Edit Form to use attached documents as background:

Code: Select all

var itemID = GetUrlKeyValue('ID');
//Takes file name from the first attachment:
var fileName = $('#idAttachmentsTable tr td.ms-vb').eq(0).text();
fd.field("PictureURL").value($.trim("https://yourDomain.sharepoint.com/sites/yourSite/Lists/yourList/Attachments/" + itemID + "/" + fileName));
var url = fd.field('PictureURL').value();
$('.sketch').css('background-image', 'url("' + url + '")');
But for this code to work, you need to make sure that all Items have an image attached to them during creation.
Cheers

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

01 Aug 2017

Thank you very much.
City of Nampa
Idaho
United States of America

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests