Forum Discussion

Re: How to shorten the display of a text field?

Hover syntax is deeper knowledge than I have. :) But I would love to learn.

------------------------------
Meagan McOlin
------------------------------

2 Replies

  • MarkShnier__You's avatar
    MarkShnier__You
    Icon for Qrew Legend rankQrew Legend
    Try this.  The left 20 character should be a Clickable Hyperlink to view the record with "hover text" to see the whole text field.



    var text Words = Left([Appt. Comments],20);
    var text URL = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];
    var text Hyperlink = "<a href=" & $URL & ">" & $Words & "</a>";

    // then define the hover text
    // Note!!, the hover text must be enclosed in a single ' character as the first space will stop the text.
    // no html allowed in the hover text
    // Use \n for line feed

    var text HoverWords =
    "'"
    & [Appt. Comments]
    & "'";

    // this below will always be the same
    "<div>" & "<span title=" & $HoverWords & ">" & $Hyperlink & "</b></span>" & "<div>"

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • Jan-WillemSpeck's avatar
      Jan-WillemSpeck
      Qrew Assistant Captain
      Hi there,

      I used to use a function like below to do this. This has a show more/less function.
      This code is no longer accepted as is seems to be forbidden Javascript.
      I also do you like your hover function. it's functional and simple, I was just wondering if there is no way to shorten text and remain the layout (I mean carriage returns) to keep it better readable?

      Thanks


      >>>>>>>>>>>>>previous code example>>>>>>>>>>>

      If([ACT_Memo]="", "", //If [Notes] is blank, display nothing
      If(Length([ACT_Memo])>300, //If [Notes] is greater than 300 characters
      var Text a = "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&Left([ACT_Memo],300)&"</pre></span>";
      var Text b = "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&NotLeft([ACT_Memo],300)&"</pre></span>";

      //"var Text a" shows the first 300 characters from [Notes]
      //"var Text b" shows the remaining text

      //The following script is the "more/less" function
      $a &
      " <a onclick=\"$(this).hide();$(this).next().show().next().show();\">Show more</a>" &
      " <span style='display:none'>" & $b & "</span>" &
      " <a style='display:none' onclick=\"$(this).hide();$(this).prev().hide().prev().show();\">Show less</a>",
      "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&[ACT_Memo]&"</pre></span>")) //If [Notes] is less than 300 characters, display [Notes]

      <<<<<<END<<<<<<<

      ------------------------------
      Jan-Willem Speckmann
      ------------------------------