Assign a URL In Code.

Does anyone know how to assign a URL to a label in code?

Tagged:

Comments

  • You use use client side java script to change the value of label by using "innerHTML". I believe you can search the 7.6 forum for examples, but here's what I can remember:

    var oLabel = document.getElementsByTagName("label");
    for (var iLabel=0; iLabel < oLabel.length; iLabel++)
    {
    if (oLabel[iLabel].id = "label tag name")
    {
    oLabel[iLabel].innerHTML = "URL Link"
    }
    }

    But with V9 its much easier, I would recommend using a Label field set to "Caluclated" caption type and reference a hidden text field:
    Caption = "HTTP://" + local.txtURLAddress;

  • I did as you suggested for V9, but the caption for the label is just a text, not a link. I cannot click on it to open that link.

    The label has URL property, and I want to assign that property dynamically.

     

  • I've attached a quick solution that I hope help explain it a bit better.

     

    URL is built dynamically based on the txtURL field.  You can change it around to see how it works.

    Label1 is the calculated label field that is clickable.   You will probably want to add additional tags in there.  (ie open in new windows, window mode, etc)