Solved

L Script to add html code before and after text in a RTF field

Posted on 2006-11-14
11
250 Views
Last Modified: 2013-12-18
I have a body field that users write articles in.

I would like to be allow them to highlight some text and run a script, the script would add [<div class="special">] at the start and [</div>] at the end.

So something like this

some textsome textsome text some text some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text
some textsome
[<div class="special">] textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome[</div>]

 textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text


I do not want to use styles and I want to retain global control over these articles that finally make their way to a website.

Any ideas anyone?

Ta


0
Comment
Question by:tashsmith
  • 5
  • 3
  • 2
11 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17942663
That's going to be a very tough one, I think... So it's in a browser? The rich-text field, is it a standard <textarea>, a Java applet or some other solution? What do you see when you look at the page source, in HTML??

No styles?? Then what does class="special" mean???
0
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 200 total points
ID: 17944936
I think we can do it through Lotus Script. It can append the Div and also append the path for the CSS file.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17945378
Browser... :-|
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:tashsmith
ID: 17945472
ok i need to give you guys mor info...

the notes database is a content management system, people are attached through notes clients not a browser..

the rtf field is translasted into html as it goes through domino for publishing.

i would like to be able to in notes allow users to wrap some html around certain paragraphs hence the [], so domino knows it is html.
that way when it reaches the website i can control it look and feel in the global .css file.

0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 300 total points
ID: 17945573
Maddy, you were right once again.

Still, I think what you want is not possible in LotusScript, on the back-end document: the content of a rich-text field must be saved prior to LotusScript handling.

It might be possible though in Formula language or in the front-end document (NotesUIDocument). Try this:

Sub Click(Source As Button)
  Dim workspace As New NotesUIWorkspace
  Dim uidoc As NotesUIDocument
  Set uidoc = workspace.CurrentDocument
  ' assume the current field has some selected text
  Call uidoc.Cut
  Call uidoc.Inserttext({[<div class="special">]})
  Call uidoc.Paste
  Call uidoc.Inserttext({[</div]})
End Sub
0
 

Author Comment

by:tashsmith
ID: 17945631
hahaha superb!!!!!

It worked first off, legend sjef!

Enjoy the points..
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 17945655
>>Maddy, you were right once again.

Sjef, you got all the points once again.

:(
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17945953
Okay, you have a point there, Madheeswar... I maybe shouldn't have given the code, so Tash would have had to look it up for her(?)self. I'll butt out for a while, and you should check your mail more often.
0
 

Author Comment

by:tashsmith
ID: 17945993

Im not understanding the politics of this at all, but gave the points to Sjef as he (?) provided me with the solution.
Madheeswar, I apologise if you feel you have been unjustifiably denied points and since Sjef feels you have a point, I will request to re-allocate points accordingly.

Thanks for your help chaps!

and yes sjef I am a girl!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17946210
As opposed to you, I do have an EE-profile... ;-))
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 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