Page 1 of 1

Tiny URL for HTML Usage

Posted: 09 Dec 2016
by Jean-Philippe Tremblay
Hi,

First Question :



My Sharepoint store a long URL into a column and i need to use it in HTML for embedded content and picture callaing.

I was planning to use the following code. As soon as i use it, i got display error such loosing tabs. Any idea how i can achieve that?


use import javaQuery.j2ee.tinyURL;

public static void main(String[] args) {

tinyURL tU = new tinyURL();
String getLink tU.getTinyURL(fd.field('LongURL_InternalName').value() );

fd.field('LongURL_InternalName').value() = getLink
}


//Assign @LongURL_InternalName in HTML Content for URL


Second question:


Is possible to get the current URL of the form and store it in a field ?


Thanks again for your Help

Re: Tiny URL for HTML Usage

Posted: 12 Dec 2016
by Dmitry Kozlov
Hi,

1. You can try the following jQuery plug-in to shorten a URL from JavaScript:

http://hayageek.com/jquery-url-shortener/

2. Use the code below to get current URL from the browser and put into a field:

Code: Select all

var currentURL = window.location.href; // getting URL
fd.field('FieldName').value(currentUrl); // putting into a field

Re: Tiny URL for HTML Usage

Posted: 29 Dec 2016
by Jean-Philippe Tremblay
Hi,

I need to get the Display URL and store it.

In javascipt, i used :

var currentURL = window.location.href; // getting URL

fd.field('FormURL').value(currentURL);


alert(fd.field('FormURL').value())


var QRCodeLinkGoogleLink = "https://chart.googleapis.com/chart?chs= ... ht=qr&chl="

var QRcodeConcatenate = QRCodeLinkGoogleLink.concat(currentURL)

fd.field('QRcodeURL').value(currentURL);
but i retrieve a blank field for FormURL. I Guess it beause the field is read-only? I have a HTML Block who use it to generate QR Code
<img src="{@QRcodeURL}" alt="QR Code" style="width:304px;height:228px;">



Is it possible to get the display URL during the New Form so i can store it? Or any Idea?

Re: Tiny URL for HTML Usage

Posted: 30 Dec 2016
by Dmitry Kozlov
Hi,

You cannot get URL of a display form until you save the item bacause its ID is populated after saving only.