![]() | ![]() |
|
09-16-2011 11:34 AM
Does anyone know how to assign a URL to a label in code?
09-16-2011 01:54 PM - last edited on 09-16-2011 01:55 PM
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;
09-19-2011 10:21 AM
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.
09-19-2011 01:06 PM
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)
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
















