Hello.
I have a notes field that I am using to display links so that the person who is updating a record can download the files from the image fields like in the screenshot below. I am having trouble making links to files that added using a URL instead of uploaded.
I have the following code to create a link from the field's value:
- if ((input.Image_2 != null) && (input.Image_2 != ""))
- {
- if (Image_2.contains("http") && !(input.Image_2.contains("zohocreator.com") || input.Image_2.contains("zoho.com"))){
- // ...the image is not stored on Zoho.
- attFile = input.Image_2.subString((input.Image_2.lastIndexOf("/") + 1)).removeLastOccurence("\" border = \"0\">");
- attUrl = thisapp.Global.extractExternalFileURL(input.Image_2);
- input.Photo_Link_2 = "<a href=\"" + attUrl + "\">" + "Download " + attFile + "</a>";
- } else {
- // ... the image was uploaded and is stored in Zoho.
- attUrl = thisapp.Global.buildAttachmentURL(reportName, input.ID.toString(), "Image_2", thisapp.Global.extractFileName(input.Image_2));
- attFile = input.Image_2.subString((input.Image_2.indexOf("_") + 1)).removeLastOccurence("\" border = \"0\">");
- input.Photo_Link_2 = "<a href=\"" + attUrl + "\">" + "Download " + attFile + "</a>";
- }
- }
The functions "extractExternalFileURL()" "buildAttachmentURL()" and "extractFileName()" simply help to generate the correct URL, and all three of them work correctly -- I made sure of that.
The problem I'm having is this:
When I try to add a link to the notes field the href attribute is removed from the string, so it just becomes "<a>Download (file name)</a>".
The links for the images that were uploaded to Zoho from a user's computer work correctly though.
Any ideas why this is happening?
Thanks.