External Hyperlink

オフライン
Hallo, recently I’ve created an self-defined ItemType with a Null-Relationship. I’ve added a string property “URL Link” to it so that it should link to external URLs. (e.g. “https://www.aras.com/”) But it is a plain text, how can I set it as Hyperlink? Thank you.
  • Hi chenze, There are a few different ways you could handle the url property on your item form. I would probably create two fields:
    1. Text field: Set the data source to your URL Link property. This field should be visible when the form is locked by the current user.
    2. HTML field: Add an anchor tag to the field content that links to the URL Link's value. This field should be visible when the form is unlocked or locked by another user.
    Here is a Gist showing some sample code for this use case: And here is the source I used for the HTML field in the example:
    <a id="my-link" href="" target="_blank"></a>
    Hope this helps! Eli
    Eli Donahue Aras Labs Software Engineer
  • Hi, I have a similar usecase than chenze. The main question is probably to use hyperlinks in the grid and not in the Form. In my case I use an additional Null-Relationship for Hyperlinks in the ItemType Part. Users shall be able to open hyperlinks directly from the relationship grid. I didn´t spent too much time on this, because I expect some kind of hyperlink data type will one day be implemented anyway. This one is my current workaround: 1. Open Relationship ItemType used for storing the hyperlinks 2. Go to Client Events tab 3. Add new OnShowItem Method 4. Add the following code
    var path = this.getProperty("link_path"); // <- use name of property that stores the hyperlink
    window.open(path, '_blank');
    This solution overrides the custom form, so it´s only sufficient when you really just store some simple hyperlinks in the relationship grid. Some other options for the Relationship grid would be a custom Action or to create a separate ItemType for hyperlinks (better look&feel). If there is a solution for a "real" hyperlink properties in grids available, I would be highly interested in it!
  • オフライン in reply to AngelaIp

    could you please explain how to add null-relationship?

  • You can add null-realtionships the same way as regular relationships. Open your target ItemType and click on the 'Relationship Types' tab. When you now use "Pick Related", you would insert a regular relationship that links to another ItemType. For a Null-relationship, change the selector to "No Related" and add a new Relationship Item. For Null-Relationships, you just have to assign a Relationship Name (=name of the Relationship ItemType) and a Tab label. If you take a look at the Part ItemType, you can see a good example how the two relationship types are used in practice. Null relationships are indicated by the orange 'plus' on the left side.

  • Hi Angelap,

    I believe this should be viewed as 2 separate questions:

    1) How do I add an on-click event to follow a URI/URL?
    This depends on where you want the link to appear, but essentially you can use the OnClick of the Grid, or OnLoad of the form as you mentioned..

    2) How do I style a string field to look like a link?
    This can be achieved by adding css to the Item (assuming you are using a property called myproperty) you could set the default value for css to
    .myproperty{
        color: #0000AA; /* Change this with links color*/
        cursor: pointer;
        text-decoration: underline;
    };

    Many thanks,
    Martin

  • オフライン in reply to Meismart

    Hi Martin

    As you explained on styling the Property of a Itemtype, I couldnt achive the same, can you explain me in better way.

    Like I added your styling code in the "Default Value" column of the Property, but still no changes occured, or the value did not look like hyperlink in the grid.

    Thanks,

    Yoga

  • オフライン in reply to Yogalakshmi

    Hi Yogalakshmi,

    Did you find any solution for the same issue?

    Thanks,

    Tejaswini