nsaiki
Scholar

How to view Attachment, when disabled?

Jump to solution

Hi,

After user submits a form with attachment, all these fields are set  to disabled to prevent from edited.

My requirement is that Approver can review all the items including attachment, and decide to approve or not.

I just found that Attachment control is acting up depending on web browser, and seeking a help to fix it.

I tired IE, FF, Chrome, and Edge. The first three browsers are behaving the same.

1. [IE, FF, Chrome] When viewing and editing, no matter what, Approver cannot open attachment. Is this because the control field is set to Disabled?

2. [Edge] Edge is the only one where Approver could open PDF both on View mode or Edit mode. However, in Edit mode, Approver was actually able to "Delete" and "Add Attachment" as well, which is not good.

So it appears that Disabled rule wasn't working on Edge to being with. Then regarding #1 above, Is there a way to allow Approver view attachment, when it is set to Disabled?

I have Update Item Permission for Approver set to "Edit" on the item, because approval task is executed on a form; "Result" and "Comment" on the screenshot. Because Approver can edit the form, I had to disable all the remaining fields.

Thank you,

-Naoko

Tags (1)
0 Kudos
Reply
7 Replies
courtney_shelto

Re: How to view Attachment, when disabled?

Jump to solution

You could somewhat leverage a workflow I made to force stuff to open in Office Online.  . Basically, the workflow goes and grabs the attachments, then writes the URLs of them to hyperlink fields. The hyperlink fields show on display, and the attachment control shows on new and edit. You could just have the attachment control show and be active on new and then have the hyperlink fields show on edit and display. And, if you didn't need to force open in Office Online, you could even nix the part where I modify the URLs to add ?web=1 at the end and save yourself a bit of trouble!

0 Kudos
Reply
nsaiki
Scholar

Re: How to view Attachment, when disabled?

Jump to solution

Thank you Courtney,

I was actually studying that link and also .

I will try and let you know if this works!

0 Kudos
Reply
nsaiki
Scholar

Re: How to view Attachment, when disabled?

Jump to solution

Hi Courtney,

Working!! but one problem...when Approver tries to edit the form (to execute his task), the hyperlink field is back messy.

Assuming Approver was able to view PDF in Display mode already, I could simply hide the messy hyperlink in Edit mode as well, but then Edit mode will lose a reference to the attachment.

I understand that this is nature of hyperlink field in Edit mode, but any way to keep the display-mode format of hyperlink in Edit mode too?

Thank you!

-Naoko

0 Kudos
Reply
courtney_shelto

Re: How to view Attachment, when disabled?

Jump to solution

Hey Naoko! I didn't even think of that. Here's what you can do though. In your control settings hyperlink fields, you can force them to always behave in "Display," never edit.

Here's what my form looks like when I do that:

Note, the Link to Attachments are the hyperlink fields. I changed the rule on my form to show those on edit and new (so I could show you this). I accomplished this by, in the designer, opening the control settings for each hyperlink field and changing the "Control Mode" from "Auto" to "Display."

Reply
courtney_shelto

Re: How to view Attachment, when disabled?

Jump to solution

Hey ‌, were you able to resolve your question with some of these tips? If so, please mark one as correct to help others in the community!

Reply
Ricardo_Garcia

Re: How to view Attachment, when disabled?

Jump to solution

Hi,

This post is a little old but i have the same issue right now and the solution that i've built it's very simple and i hope this help someone that come here with the same problem.

One simple way to fix this is adpatating the rule that disable the attachments control to be disabled only on edit mode, that way opening the view form mode our links will be clicable.

0 Kudos
Reply
Mark_U
Scholar

Re: How to view Attachment, when disabled?

Jump to solution

Hello,

I can't believe I haven't noticed this problem before. It should be possible to disable adding and deleting attachments without losing the ability to view them.

 

For me, a better and simpler workaround was to use jQuery to remove the disabled attribute of the attachment link.

NWF.FormFiller.Events.RegisterAfterReady(function(){
	NWF$("table.nf-attachmentsTable td.ms-vb a").removeAttr("disabled");
});

This targets the attachment table, then the cell with the attachment link (otherwise you enable deletion as well), then the link itself. 

 

I've only tested it on an SP2013 classic form, via Chrome, but it should work in other circumstances.

 

I'm actually using the following code so it also opens attachments in a new window.

NWF$("table.nf-attachmentsTable td.ms-vb a").removeAttr("disabled").attr("target", "_blank");

 

Hope someone finds this useful!

 

0 Kudos
Reply