Discussions

Expand all | Collapse all

Trouble creating a table (not a quick base table) using a formula rich text field

  • 1.  Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 13:05
      |   view attached
    Hello,

    I have successfully coded a rich text field to display data in the form of a table with no borders. However, when the field displays on the form in Quick Base, there is a ton of white space at the top of the field. I can't figure out what is causing this. Any help would be great. I have included a file with 2 screenshots. One is the code and the other is how it is displaying. Thanks, Dave.

    ------------------------------
    David McFadyen
    ------------------------------

    Attachment(s)

    pdf
    Screen shots.pdf   307K 1 version


  • 2.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 13:17
    Could you embed the screenshots rather than posting a pdf? You should be basically able to copy and paste them into the post. Also if you post your code as text then people can edit and view it easier.


  • 3.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 13:39
    Austin,

    Thanks for the tips. Below is the field displaying and the code.

    Field on form




    Code

    If([Payment Breakdown Choice] = "10,20,30,30,10",

    "<table cellspacing=30>" &
    "<tr><td>" & "<b>" & "10%" & "</b>" & "</td>" & "<td style='text-decoration: underline'>" & "<b>" & [10% Due Upon (Various)] & "</b>" & "</td>" & "<td>" & "due upon acceptance of proposal" & "</td> </tr><br /><br />" &
    "<tr><td>" & "<b>" & "20%" & "</b>" & "</td>" & "<td style='text-decoration: underline'>" & "<b>" & [20% Due to Initiate] & "</td>" & "<td>" & "due to initiate project construction." & "</td> </tr><br /><br />" &
    "<tr><td>" & "<b>" & "30%" & "</b>" & "</td>" & "<td style='text-decoration: underline'>" & "<b>" & [30% Due at 50%] & "</td>" & "<td>" & "due upon completion of 50% of the project construction." & "</td> </tr><br /><br />" &
    "<tr><td>" & "<b>" & "30%" & "</b>" & "</td>" & "<td style='text-decoration: underline'>" & "<b>" & [30% Due at 90%] & "</td>" & "<td>" & "due upon completion of 90% of the project construction." & "</td> </tr><br /><br />" &
    "<tr><td>" & "<b>" & "10%" & "</b>" & "</td>" & "<td style='text-decoration: underline'>" & "<b>" & [10% Due Upon (Various)] & "</td>" & "<td>" & "due upon project completion and approval/acceptance by the Owner." & "</td> </tr><br /><br />" &

    "</table>", "This is a test.")



    ------------------------------
    David McFadyen
    ------------------------------



  • 4.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 14:48
    Edited by Austin K 02-04-2020 14:48
    The entire Rich Text field element in the dom has 10 line breaks in it above the code that you inserted into the field when using the above code. This is the hint at how to fix it because you also have 10 line breaks in your code. Remove those and just use the cell spacing or other styles to adjust the table and it should work for you. I just tested it myself.


  • 5.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 15:01
    Austin,

    Thanks for the tip. I am not trained in html so I just learn as I go. Are you saying to remove the line breaks from the code and that will fix it? How can you tell that there are 10 line breaks before the code?

    ------------------------------
    David McFadyen
    ------------------------------



  • 6.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 15:05
    Austin,

    Your suggestion worked. Thanks very much.

    ------------------------------
    David McFadyen
    ------------------------------



  • 7.  RE: Trouble creating a table (not a quick base table) using a formula rich text field

    Posted 02-04-2020 15:18
    The way I could tell was I had to dive into it via the Chrome developer menu. I can show you a screenshot of what your code looked like in the dom. It won't be as valuable as if I could show you how to get there exactly but hopefully it helps some.

    What I did was press F12 in chrome to open the dev menu and go to the Elements tab. You can hover over each line of html here and Chrome will highlight where it is used on the screen if it is visible to you. I hovered and checked until I found the container for all the fields on the form (the div has an ID of "mainBodyDiv".) Then rinse and repeat until you are down to the exact field you need.


    There are another roughly 6+ layers above this that I had to go through to get here. You can see how your "<table cellspacing=30" code is beginning at the bottom. For some reason Quick Base just extracted all of your line breaks and put them above it.