Tiny URL for HTML Usage

rss

Posted by Jean-Philippe Tremblay - Dec 9 ’16 at 08:41

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

 


  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 18 days
    #1 by Dmitry Kozlov Dec 12 ’16 at 04:13

    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:

    var currentURL = window.location.href; // getting URL
    fd.field('FieldName').value(currentUrl); // putting into a field
    
  • Jean-Philippe Tremblay
    Jean-Philippe Tremblay
    Member
    Member for: 3 years 1 day
    #2 by Jean-Philippe Tremblay Dec 29 ’16 at 09:45

    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=150x150&cht=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?

     

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 18 days
    #3 by Dmitry Kozlov Dec 30 ’16 at 09:36

    [#2]: Hi,

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

Displaying 1 to 3 of 3 messages