Forum Discussion
MatthewMatthew1
9 years agoQrew Trainee
I figured it out with a lot of googling. Copy everything below and replace [Notes] with your field name.
If([Notes]="", "", //If [Notes] is blank, display nothing
If(Length([Notes])>300, //If [Notes] is greater than 300 characters
var Text a = "<span id="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&Left([Notes],300)&"</pre></span>";
var Text b = "<span id="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&NotLeft([Notes],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="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&[Notes]&"</pre></span>")) //If [Notes] is less than 300 characters, display [Notes]
If([Notes]="", "", //If [Notes] is blank, display nothing
If(Length([Notes])>300, //If [Notes] is greater than 300 characters
var Text a = "<span id="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&Left([Notes],300)&"</pre></span>";
var Text b = "<span id="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&NotLeft([Notes],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="Detail"'><pre style='font-family:"Helvetica","Tahoma","Arial","sans-serif"!important;font-size:100%!important;white-space:pre-wrap!important;'>"&[Notes]&"</pre></span>")) //If [Notes] is less than 300 characters, display [Notes]