Forum Discussion

SaviNewman1's avatar
SaviNewman1
Qrew Trainee
4 days ago

Legacy Form + Rich Formula Field

I want to display a link on my form. It needs to be displayed always. 

The code I used in the older form was:

var text Words = "Core Rules";
var text URL = URLRoot() & "up/" & [_DBID_Documents] & "/a/r" & "5974" & "/e6/v0";

"<a href=" & $URL & ">" & $Words & "</a>"

i.e: Name of link, and the url to the document already stored in quickbase from another table. Flipping from the older form, it works, and moving it to the new legacy form, it shows the following error:

"400 Error Invalid field type"

The specified field was not a File Attachment field

If the problem persists, reach out to your app admin, check the Quickbase service page. or open a support case"

 

How can I fix this for the new legacy form? The link works, but clicking on it, I get that error. Below is how it looks on every employee's portal. The links just don't work now. HELP! 

I created a new field, and typed in the code, and it displays the same behavior. 

3 Replies

  • Maria's avatar
    Maria
    Community Manager

    Hey Savi, 

    I presume this link code is in a rich text field. If the doc is not in an attachment field what are you trying to share? A record? I think we need a bit more context before we can help on this. While I'm not sure exactly what's happening, I can share some formulas that have worked for me in the past: 

    Rich Text Clickable File Name:

    var text URL= 
        URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e108/v0";
    var text Name=
        ToText([File Attachment]);
       
    "<a href=" & $URL & ">" & $Name & "</a>"

     

    Formula URL to show attachment address:

    URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e7/v0"

    *Note: Replace the e7 above with field ID of attachment, e43, or whatever it is. 
    This example assumes the attachment field is field ID 7. To make this work in your app you will need to replace the e7 in this string of characters with the field ID of your attachment field. So if in your app the attachment field is field ID 12, your formula would look like this: URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e12/v0'

    Display attached image: 

    "<img src =" & URLRoot() &"/up/" & Dbid () & "/a/r" & [Record ID#] & "/e6/v0\" height=\"300\" width=\"375\" target=_blank />"

    *Note: The same note applies to this formula. e6 should identify the field where your file resides, in this case Field ID 6

     

    • SaviNewman1's avatar
      SaviNewman1
      Qrew Trainee

      Thanks for all the information!

       

      My goal is, when I create a new employee in our system, certain files are always available without me having to upload a new attachment. I want to upload it once and then have a formula display my uploaded file across all employees as part of the form.  

       

      This code worked in the old style form and still does when I go to the old form. 

  • Maria's avatar
    Maria
    Community Manager

    I think I have spotted the issue. The old form appears to not be such a stickler for syntax. Maybe? 

    An HTML link needs quotes around the URL. I believe your original formula doesn't keep quotes around the URL. A typical HTML link looks like this: 
    <a href="https://www.w3schools.com/tags/att_a_href.asp">Visit W3Schools</a>

    I believe your formula generates this instead: 
    <a href=https://www.w3schools.com/tags/att_a_href.asp>Visit W3Schools</a>

    Notice how the URL doesn't have quotes around it. Try the scrap of code below to add in the missing quotes: 

    "<a href=\"" & $URL & "\">" & $Words & "</a>"

    Adding a \ before a character that would otherwise be read as code is called "escaping" that character.