Solved

manipulate character in a string -Rich text field

Posted on 2006-06-12
12
347 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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