Email:   
Home
In This Issue
Email a Friend
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Changing Rich Text font styles on the Web (continued)

Comments about the tip
One thing that alert readers pointed out to me is that you can also use the DIV tag instead of the SPAN tag and achieve the same result. Also, keep in mind that if you're using tables, this probably won't work for you. A better solution when you're using tables is to either use the technique outlined below or to specify a class for each of the table cells by setting the CLASS property of each individual cell. Trying to apply a class to a whole table at once doesn't work correctly in all browsers, in my experience.

Overriding the style of Notes fields on the Web
I received a lot of responses to that first tip, so here I'm going to share some of what I've learned by showing you a quick way to make font changes on your forms without having to insert code into the HTML Attributes for individual fields or wrapping code around fields.

If you would like to define a style to use to override the formatting of a Rich Text field that a user creates, or if you want to define a style for inputting information into a form, put the following code into the HTML Head Content object of your form:

c := @Char(13);

"<STYLE type=\"text/css\">" + c +
"<!--" + c +
" FONT { font-family: Verdana, Arial, sans-serif; font-size: 10pt; color:\"#000000\" }" +
" INPUT { font-family: Verdana, Arial, sans-serif; font-size: 12pt; color:\"#0000FF\"; }" + c +
" SELECT { font-family: Verdana, Arial, sans-serif; font-size: 12pt; color:\"0000FF\"; }" + c +
" TEXTAREA { font-family: Verdana, Arial, sans-serif; font-size: 12pt; color:\"0000FF\"; }" + c +
"-->" + c +
"</STYLE>" + c

The FONT style definition will override the style of any Rich Text field that the user has formatted when the document is opened in read mode. The INPUT, SELECT, and TEXTAREA style definitions are used when the document is in edit mode, and they even work on Rich Text fields. The "c" temporary variable is used to create hard returns so that the code is easier to see when you view the source of the page (which comes in handy if you have to troubleshoot).

An alternative to putting this code in every form is to put it in a central location and then do an @DbLookup in the HTML Head Content field to retrieve it. This makes it much easier to immediately make global changes.

Comments on this tip
I had been having trouble with the display of a specific form for quite some time. I couldn't get it to display correctly. It was for a form that displayed documents in a database with content that we didn't control. I first tried using the technique outlined in the first tip and put FONT tags around the Rich Text fields I wanted to format, and this worked for some fields but not all of them. I kept trying to figure out why this didn't always work, but to no avail. The solution turned out to be to simply put a style definition for FONT in the HTML Head section (or the stylesheet file) that then format these stubborn fields exactly as I wanted them to appear. The solution was so simple, I couldn't believe it.




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

2-Minute Tutorials
How do I...

  • integrate MS Office or OpenOffice with Notes?
  • create cross-tab reports and charts?
  • print serial letters and mailing labels?
  • create PDFs in Lotus Notes?


Check out the 2-minute tutorials here.
-- Advertisement --

The Ultimate Notes Domino Training Experience - Amsterdam, 11-13 November
Get in-depth technical training that you can put to use on the job right away at THE VIEW's Admin2008 and Lotus Developer2008 Europe! One registration gets you into your choice of over 70 new and updated expert know-how sessions, one-on-one consultations, hands-on labs, and more.

See complete agendas and register by 10 October to save 495 euros!
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login