Solved

manipulate character in a string -Rich text field

Posted on 2006-06-12
12
345 Views
Last Modified: 2013-12-18
Hi

I want to change the color of the character in string stored in Rich text field.

For eg. "abcdefhj????sddf"

I want to change the color of the "?" mark to red color.
TIA
0
Comment
Question by:kousis
  • 4
  • 4
  • 2
12 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 16892106
Client or web?
0
 

Author Comment

by:kousis
ID: 16893041
it's on web
0
 

Author Comment

by:kousis
ID: 16900974
can anyone pls answer this question
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16904224
I sent a note off to CRAK to see if he would look at this for you.  I'm not at a Notes Computer or environement to set up a simulation.
0
 
LVL 13

Accepted Solution

by:
CRAK earned 100 total points
ID: 16905175
Wow.... Marilyn, why should this be special expertise of mine?
But up to a certain level you may be right (and thanks for the notification!):

I've created a test form with a RT field and filled it out:
abcdefg???hijkl
And just for fun, I colored "de" blue (rest was black).

In a web-copy of the form, I added following JS-code; right on the form where the RT field would be.
It was all marked as pass-though html, except the actual RT field, marked here as [RTFIELD] (yes, keep the single quotes around it!).

<Script language="javascript">
var rt='[RTFIELD]';
document.write(rt + '<br>')
var lastChar = '';
var currChar = '';
for (var i=0; i<rt.length; i++)
{
   currChar = rt.substr(i,1);
   if ((currChar=='?') && (lastChar!='?'))
   {
      document.write('<span style="color:red;">' + currChar);
   }
   else
   {
      if ((currChar!='?') && (lastChar=='?'))
      {
         document.write('</span>' + currChar);
      }
      else
      {
         document.write(currChar);
      }
   }
   lastChar = currChar;
}
</Script>

Perhaps here are easier ways (I'm curious!) or perhaps even better ones, as this one probably has a few limitations.
E.g. string length might may have limitations. Or the use of single or double quites inside the Rt field may cause trouble, but at least in the given example it'll work.

Do note that this won't do any good in editmode! it's read-mode only!

Feel free to redefine the <span> to refer to a stylesheet. A <font. definition wold be another option.

Enjoy!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Expert Comment

by:CRAK
ID: 16905259
Forgot to mention:
Do NOT mark the RT field as pass-through html: allow domino to do the html conversion first, for the best result!
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16908003
it's read-mode only!<< Yeah, I figured it would be only good in read-only using javascript.  
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16908005
But, SEE!! I knew you would know!!
0
 
LVL 13

Expert Comment

by:CRAK
ID: 16909305
;-))
I'm not too thrilled with the limitations though....
Since its processing domino's html output, it shouldn't matter if the RT field would contain e.g. a table with strings like that.
Domino, however, splits the html code for a table into several lines; something that JS isn't happy with (=unterminated strings)!
We should find a way to "@impode" RT's html output befor we allow JS to parse it....
I've already been thinking of involving @Abstract in the process, but that would make me lose other details from the RT field (e.g. those blue characters).
0
 
LVL 13

Expert Comment

by:CRAK
ID: 16949490
kousis, did my post help in any way?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Encrypted Mail message in a NSF 10 29
Not displayed font name 14 98
Bold Courier in RichEditControl 6 98
Outlook Contact Export as .msg trying to import in Lotus Notes 5 97
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now