Hyperlinks from Label fields using variables

I have a requirement to link a form to an online user manual at field level. I know I can hardcode a specific URL against a label, which works fine on our development server, but I have to deploy the process in multiple jurisdictions each with their own specific online manuals.

 

Ideally, I would like to create the URL string variable using a combination of fixed and parameter driven data which I can manage through a parameter table, then pass the variable to the labels at 'when user loads form' when the user location has been determined.

 

Does anyone know of a clever way of achieving this?

Tagged:

Comments

  • Hi John,

     

    Not sure what version you are using but you can now have dynamic labels - choose 'calculated' in the caption type property of your label and set your formula accordingly.  Hope this helps.

  • Hi, It's version 9.0.3. As far as I can see the label can be dynamic but the URL it calls has to be hardcoded.

     

    John

  • Yes of course, the url is the extension.

  • Use a text field and set the Client Extentions property to URL. You can then build the URL dynamicallly.

     

    The link caption is the field caption.

     

    This URL is not dynamic, in that it cannot be rebuilt on a form refresh, but can be set to anything you like on a form load.

     

    I hope that helps.

  • Using the DOM (Document Object Model), which is not offiically supported (as BPM could change and this will no longer function), one could use some javascript client side scripting to change the link.

     

    Attached is a file (LabelLink.7z) compressed in 7-zip format (http://www.7-zip.org/), a free compression utlitiy, which contains a video and the sample project. I had to compress this inside a .zip file in order to post the file, but you will need this utility to get the code and the video from the zip file.

     

    Basically, the label has any initial URL (the sample uses http://www.opentext.com/) and then the numeric field has the client side event, On field exit (OnBlur) set to the following:

     

     

    document.links[0].href="<a data-ignore="a/b" target="_blank" href="http://communitycentral.metastorm.com/t5/Welcome/bd-p/Hello/">http://communitycentral.metastorm.com/t5/Welcome/bd-p/Hello/</a>" + document.getElementById("Number1_Editor_Value").value;
    

     

    This, of course, assumes there is only one link (href) on the page or is the first link since document.links[0] will be the first link. When you leave the field Number1, the link is set to another site (http://communitycentral.metastorm.com/t5/Welcome/bd-p/Hello/) and the value of the numeric field is added to the url, so it would change dynamically based on the value.

     

    The value is obtained using document.getElementById("Number1_Editor_Value").value, where the field is "Number1", but because of the way code is generated, you would use __Editor_Value.

     

    For example, if your field was MyField, you would use:

     

     

    document.getElementById("MyField_Editor_Value").value;