Solved

manipulate character in a string -Rich text field

Posted on 2006-06-12
12
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Disable Return Receipt In Lotus Notes 15 497
Outlook Font 8 108
Issues with Word font 4 91
Lotus Script - Exporting Attachments and Folder Creation 2 122
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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