Discussions

Expand all | Collapse all

Hyperlink in a Rich Text Formula

  • 1.  Hyperlink in a Rich Text Formula

    Posted 06-18-2019 21:12
    Hi,

    I am trying to create a rich text field that based on certain data either returns a plain text message or a hyperlink that is grabbed from another URL field on the same table. Below is what I have so far, but the Hyperlink though displaying correctly in the output is getting an error message when I click on it. I can confirm that the URL is correct though as it works when I click on it in the URL field.  

    var text URLWords=ToText([URL Field])
    var text URL="<a href="&[URL Field]&">"&$URLWords&"</a>";

    If([FileAttached]=true, "File Attached",$URL)

    Below is a pic of the error message I am receiving. Any help would be appreciated! 




  • 2.  RE: Hyperlink in a Rich Text Formula

    Bronze
    Contributor
    Posted 06-18-2019 21:20
    Try wrapping your href in single quotes 

    HTML elements and their components need to be in quotes so the browser knows the difference.

    So:
    var text URL="<a href='"&[URL Field]&"'>"&$URLWords&"</a>";

    for spacing so you can see where the single quotes are - dont use the below
    var text URL="<a href=' "&[URL Field]&" '>"&$URLWords&"</a>";


    Chayce Duncan | Director of Strategic Solutions
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base


  • 3.  RE: Hyperlink in a Rich Text Formula

    Posted 06-18-2019 21:26
    No luck, still returning the same result. Could it be something with needing to the http:// in the rich text formula? 

    using google.com as an example the URL field is returning http://www.google.com, but the rich text field is only returning www.google.com 




  • 4.  RE: Hyperlink in a Rich Text Formula

    Bronze
    Contributor
    Posted 06-18-2019 21:34
    I tested it per your comment - looks like you do need the https:// in front in order for Quick Base to not interpret it as a link to itself. Maybe add something like 

    var text urlH = if( not contains([URL Field]),"https://" & [URL Field],[URL Field]);

    Then use that $urlH in place of [URL field] in your <a> tag. Depending on your workflow - you might always consider throwing a target='_blank' in your <a> - this way it opens this link in a new tab instead of the same window - unless that is the intent. 

    So: <a href='urltarget='_blank'>Link Text</a>

    Chayce Duncan | Director of Strategic Solutions
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base


  • 5.  RE: Hyperlink in a Rich Text Formula

    Posted 06-18-2019 21:54
    Even when I use a var text to add the http:// before the URL i'm still getting same error (QB does not recognize the link) which is frustrating because the link is the exact same to what is showing in the URL field (as seen in screenshot below). 

    The only way that seems to actually be working is when i type the exact URL into the a=href formula (ie. var text URL="<a href=' "www.google.com"'&"; '>"&$URLWords&"</a>"; Unfortunately that wont work for me since the URL is always going to be different. 

    any other ideas? If not i have appreciated your help and speedy responses regardless!  





  • 6.  RE: Hyperlink in a Rich Text Formula

    Bronze
    Contributor
    Posted 06-19-2019 14:32
    Do you need to use ToText() for your URL field so that is interpreted in the rich text field?


  • 7.  RE: Hyperlink in a Rich Text Formula

    Posted 06-19-2019 14:44
    tried that too. No luck :/


  • 8.  RE: Hyperlink in a Rich Text Formula

    Posted 06-19-2019 15:24
    Have tried the approach of doing the same thing through dynamic form rules?
    If the file is attached, show a formula-text field with your message and hide URL field, then if not, show your URL field and hide the text field.


  • 9.  RE: Hyperlink in a Rich Text Formula

    Posted 06-19-2019 15:30
    Unfortunately this field is meant to live on a report and in an email notification which is why the Form Rules won't work in this scenario. Thank you for the suggestion though!


  • 10.  RE: Hyperlink in a Rich Text Formula

    Bronze
    Contributor
    Posted 06-19-2019 15:31
    Take a look at this post - specifically the very very last comment presented by Coach. Him and I had a back and forth on a somewhat similar topic - and I remember him now mentioning that there are realm settings that is a bit off the beaten path to find that can limit your ability to redirect or open external links
    https://community.quickbase.com/quickbase/topics/edit-a-record-and-redirect-to-an-outside-website


    Chayce Duncan | Director of Strategic Solutions
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base


  • 11.  RE: Hyperlink in a Rich Text Formula

    Posted 06-19-2019 15:36
    Yes, I�m sure that�s it. They default Realms to block external redirects and also they may default Realms to block external frames.