How can I put a clickable hyperlink to an external URL in a field on a single record and/or on a layout for all records?
Couple of different ways to do this:
1) If you want to make it just a text object on a layout, make it a button and attach it to a script using the Open URL script step (or just the single script step) that points to the external URL.
2) If it's a field, make the field a button and do the same thing. If the field contains the URL, you can feed the field contents to the Open URL script step to make it depend on what record you're on.
You can make the field a button to Open URL (the field). But it is no longer editable (as it's now a button), so I often put a button beside the field which performs this script step. OR I put a web viewer on the layout which "calls" the URL field.
OK, I'm slow. But what I need is essentially what WORD does with and URL address, i.e. formats it as a hyperlink. I think you explain this as "you can feed the field contents to the Open URL script step." I don't understand this. I can only create buttons in Layout Mode, and then they appear on every record and do only what's in the URL.
I don't think you can do that. I've been frustrated even wanting to have a row of fixed text on a layout (ie: not even field data) and not being able to dynamically have:
"For more information click here, and to contact them click here"
I can do it by placing buttons over the exact text 'here' and 'here', but it is ropey - if I retype or re-size the underlying text the buttons need to be carefully realigned. And it isn't always perfect when zooming the screen, I think.
You can do this in a Web Viewer, but not a fixed text object.
Hi Mike_M! can you clarify 'not a fixed text object'? I'm presuming you mean a text block or field on the layout.
Whereas the WebViewer has the data URI with the text and hyperlink and shows all correctly. If this type of text is put into a WebViewer, then any hyperlink clicked will show the result in the same WebViewer (it will not take the user outside FM to a browser).
"data:text/html,This is a link <a href='http://filemaker.com'>FileMaker Inc</a> to filemaker.com."
if, OTOH, you specify a target attribute, the browser should be called directly to open the link:
"data:text/html,This is a link <a href='http://filemaker.com' target='mypage'>FileMaker Inc</a> to filemaker.com."
What they want to do is put text on a layout with embedded, clickable links. You can kinda sorta do that with underlying buttons, as Alan mentioned, but you have issues as he mentioned.
I agree! a HyperLink "option" to a segment of text (like we can format a number or date). but with "inline" hyperlink, it would be tricky.
like this Product Idea?
You can put text in a field with a particular style (such as blue and underlined) identifying hyperlinks within the text. Clicking the text in the field trips a script trigger that checks the text next to the cursor position produced by the click. If it's of the specified style, scan left and right to parse out the desired text to pass on to the Open Url step and open the address in the user's default web browser.
This technique does not work in FM GO where the app insists on putting the cursor at the end of the text in the field no matter where you tap. (Grrrr....)
A working example of this can be found in the last layout of:
Adventures in FileMaking #1 - Conditional Value Lists
Edit note: original "paste" from another of my replies left out the "link" code and had to edit it in on the second try.
That is clever, Phil. Very clever.
Couple of very minor points:
- how do you edit the text, as it commits the record as soon as you click into it? Is the only way to turn off the script trigger? (Thinking: to avoid having to enter the design environment a second copy of the field somewhere with no trigger would suffice, of course.)
- the text has to be the full URL, obviously, but if the short placeholder 'English' text was unique (like a bitly link) it could presumably be 'converted' by another table into the full URL.
- and the trick could also fire scripts, of course, not just be used to open a URL - and presumably a SnapShot link.
- it actually makes it easier to locate hyperlinks in a field of data rather than a text object!
Thanks for sharing that, Phil.
(Edit: when Phil said 'the last layout' it's as shown to the very right of the navigation bar ('Additional Resources'), not as the last layout in layout mode.)
Since it's a calculation field, I have another layout where I can edit the text referenced in the calculation. You can actually go looking for it in the Adventures in FileMaking file to see how I do it. In this case, I actually have a table of entries sort of like a bibliography and the calculation pulls it all together into a list in a single field where I can then set up the script trigger.
There are multiple variations possible and you've mentioned some nice ones. My original idea was to set up a "reader" where clicking or tapping a word with a contrasting text style took you to a new "article" in the solution. This can give the reader a "wedge" structured source of information where knowledgeable readers read the top level article and those needing to learn more can click or tap links to "drill down" into more detailed information. But then I discovered that this doesn't work in FM GO so I shelved those plans and only resurrected this part of the idea when it seemed useful for my Adventures files.
It’s very clever, Phil. Can you elaborate on why you chose this instead of a Web Viewer for the same effect?
I had a solution that was pre-WV that did something similar. Sorry I don't have any examples, as it may have been pre FM07.
I'd already worked out the details for another purpose, as I've previously mentioned. To go the web viewer route, I'd have had to start over and figure out the details for displaying that data in a web viewer. So it was a case of using a tool that I already had good to go in my tool box more than anything else.
Retrieving data ...