Hyper link with property value as form field

Hi,

I have a form with two fields

One is a text field AA where user enters a text "PC-1234"

Then the other field shall after save be a hyperlink field containing "the web url"+field AA value

Http://webpageABC.com/PC1234

so user can click on the hyperlink and have the web page opened in a new window

I've been looking around in some old post's but not been able to solve it

Please help

//Mikael

  • OK, I have solved one of the issues I had with this

    I can now update a field with the "url"+ "value from another field"

    my code to run in OnBeforeUpdate and OnBeforeAdd

    //my code----

    Innovator inn = this.getInnovator();


    string AA = "my URL"+this.getProperty("field with value");
    this.setProperty("my field with complete URL", AA.ToString());

    return this;

    //-----------

    So how can I now set "my field with complete URL" to present it as an clickable hyperlink??

  • Hi MKalla

    I guess you need to use HTML to create the link.

    Step 1: Create a HTML element in your form

    Step 2: Add the below Code in HTML Code

    <a id="newlink" href="#" onclick="return showURL();" target="_blank" style="color: #3668B1;text-decoration: underline">Click Here</a>
    <script>
    function showURL() {
    debugger;
    var description = document.thisItem.getProperty("description");
    var baseURL = "https://www.w3schools.com/";
    var specificURL = "";
    if (description) {
    specificURL = baseURL + description;
    document.getElementById("newlink").href = specificURL ;
    } else {
    top.aras.AlertError("Please Enter the field with value.");
    return false;
    }
    };
    </script>

    Step 3: Save Form

    Here description tag is the dynamic value field you want to append to URL. Let me know if it helps.

    Thank You

    Gopikrishnan R

  • Hi Gopikrishnan,

    Thanks, but I get this error clicking on the link

  • Hi,

    I solved it

    missed that you had combined two strings in the URL

    Since my field contained the whole URL, then I just cleared

     "https://www.w3schools.com/" and set it to ""

    THANKS!!

  • would it be possible to show the "field value" as URL text instead of "Click Here" ?

  • I managed to solve that too.

    Added a method to the form event and set it to onFormPopulated

    code:

    function updateStatus()
    {
    var newString = document.thisItem.getProperty("my field with value to display as hyperlink");
    document.getElementById("newlink").innerHTML = newString;

    }
    updateStatus();