Tip

Display rich text field contents without cluttering the view

We sometimes use rich text fields for capturing just plain text information...specifically for Web users who would like to enter their text in a text area rather than in a small text box on their browsers. But then, how do you display all the text entered, in a view without cluttering it?


Put the following code in the HTML Head of your $$View template form having the embedded view

 "<style> td .cel{font-family:arial; font-size:12px; color:#FFFFFF; font-weight:bold; background-color: orange} table .tab{width:100%; height:100%; NOWRAP} #dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;} </style>"

Put the following code at the top of the $$ViewTemplate form and pass them through HTML:

 <!-- This code is for showing a pop-up layer --> <DIV ID="dek"></DIV> <SCRIPT TYPE="text/javascript"> <!-- Xoffset=10; // modify these values to ... Yoffset= 0; // change the popup position. var old,skn,iex=(document.all),yyy=-550; var ns4=document.layers var ns6=document.getElementById&&!document.all var ie4=document.all if (ns4) skn=document.dek else if (ns6) skn=document.getElementById("dek").style else if (ie4) skn=document.all.dek.style if(ns4)document.captureEvents(Event.MOUSEMOVE); else{ skn.visibility="visible" skn.display="none" } document.onmousemove=get_mouse; function popup(msg,bak){ var content="<TABLE WIDTH=140 BORDER=1 BORDERCOLOR=orange CELLPADDING=8 CELLSPACING=0 "+ "BGCOLOR="+bak+"><TD ALIGN=center><FONT COLOR=black SIZE=2>"+msg+"</FONT></TD></TABLE>"; yyy=Yoffset; if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"} if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''} if(ie4){document.all("dek").innerHTML=content;skn.display=''} } function get_mouse(e){ var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft; skn.left=x+Xoffset; var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop; skn.top=y+yyy; } function kill(){ yyy=-1000; if(ns4){skn.visibility="hidden";} else if (ns6||ie4) skn.display="none" } //--> </SCRIPT>

Put the following code in the formula of the column you want to show the contents on the richtext field in (assume your richtext field is "MyRichText")

 display := @Abstract([TryFit]; 4000 ; "" ; "MyRichText") link := "[<a href="#" ONMOUSEOVER="popup('<font face=verdana size=1><b>"+ display +"</b></font>','lightyellow')"; ONMOUSEOUT="kill()"><img src="bullet.gif" border="0"></a>]"; @If(display ="";"";link)

Of course, you need to have an image resource called "bullet.gif". Keeping mouse pointer on the image (when users open your view on their browser) makes a layer to popup displaying contents of the richtext field "MyRichText". This way the view is not cluttered with lot of texts and the document need not be opened to read the richtext field contents.

This was first published in October 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.