Autor Thema: Modify a RTF field . Refresh it - Strange behaviour !  (Gelesen 3918 mal)

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
I want to have a rich text field to add comments to while protecting
what is already in there without changing user access control or
redesigning the database.

It works like this (with 3 fields):
1) Computed rich text field, CommentsDisplay with formula Comments
2) Rich text field, Comments, which does not show up on form at all --
it contains previous comments
3) Editable rich text field, NewComments -- where th user add his
input and attach docs

and the code in the PostSave form event :
Code
Sub Postsave(Source As Notesuidocument)
Dim mainDoc As NotesDocument
Set mainDoc=Source.Document
Call mainDoc.RemoveItem( "CommentsDisplay" )
Dim rtitemA As Variant
Dim rtitemB As Variant
Set rtitemA = mainDoc.GetFirstItem( "Comments" )
Set rtitemB = mainDoc.GetFirstItem( "NewComments" )
Call rtitemA.AppendRTItem( rtitemB )
Call rtitemB.Remove
Call mainDoc.Save(False, True )
End Sub

but it is a strange behaviour:

step 1: I create a new doc
step 2: I put the string "1" in the NewComments field
step 3: I save the doc
step 4: when I open the doc :
Comments field "1"
CommentsDisplay field nothing
NewComments field nothing
step 5: I put the string "2" in the NewComments field
step 6: I save the doc
step 7: when I open the doc :
Comments field "12"
CommentsDisplay field "1"
NewComments field nothing
step 8: I put the string "3" in the NewComments field
step 9: I save the doc
step 10: when I open the doc :
Comments field "123"
CommentsDisplay field "12"
NewComments field nothing


Why the field CommentsDisplay which had a computed formula doesn't refresh on doc open ?!? (it is with a step backward than Comments field ...) ?
« Letzte Änderung: 22.10.02 - 12:44:05 von Toma Bogdan »

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #1 am: 22.10.02 - 14:09:00 »
jez.. :o :o

just a try:
use the field comments and newcomments
make comments > computed => on field comments itself

then your script and all seems ok now...


And what about the commentsdisplay field?
...i´m not too sure with computed RichText field types, but take a look at the field values in the read mode ... the rt field "comments" is twice there.."comments" and "comments"! Containing the old values in "one" field and the newest values in the "second" field. So, this could be the explanation that commentsdisplay is always one behind.
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
More .... and a sample !
« Antwort #2 am: 22.10.02 - 15:05:29 »
The Comments field keesp the last inputs of the users to prevent them to modify something ! I display this information into CommentsDisplay field and after they write something in the NewComments field I add this field to the Comments field !

Here is the sample Notes database (zipped) !

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #3 am: 22.10.02 - 15:09:30 »
ok, i think i understood it .. ;)

but, once again: the problem is - im very sure about - , that the commentsdisplay field is related to the comments field, which exists twice after the first save.

1. creation of doc
entering AA
2. saving first time
3. read mode: 2 (!!!) fields "comments" in the field list>
first  "comments": AA
second "comments" : empty
4. edit doc
entering "BB"
5. saving
6. again two comments fields
first "AABB"
second "BB"
....

see what i mean?
Commentsdisplay always shows the right field, but which one of both ?  ;D
« Letzte Änderung: 22.10.02 - 15:15:23 von Rob Green »
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
a solution ?
« Antwort #4 am: 22.10.02 - 15:15:35 »
I suppose that you saw the sample ! I belive that it is a simple solution ... but what is that solution  ???

Regards

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #5 am: 22.10.02 - 15:17:24 »
at the moment i have no idea...its a strange behaviour....maybe take a look at the LN Knowledge base:
http://www-3.ibm.com/software/lotus/support/

enter the phrase "appenditem" e.g.
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
Notes bug.....
« Antwort #7 am: 22.10.02 - 15:50:45 »
again a Notes bug ... maybe in R6 it will not be the same  :-\

but how can I restrict the user to modify the last posts.... just to see what he had post .... and the user to have the permisson to add other comments to this field ?

i am a little confused now ....

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
version 4.x bug ?
« Antwort #8 am: 22.10.02 - 15:54:02 »
at this address http://www-1.ibm.com/support/docview.wss?rs=475&context=SSKTWP&q=computed%2Brich&uid=sim1d37dd1d35bcd5991852566860064271f I saw that they reffer to the .... Software version: Notes 4.x  :o

but the reality is other .....
« Letzte Änderung: 22.10.02 - 15:54:26 von Toma Bogdan »

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #9 am: 22.10.02 - 15:56:28 »
if it would be fixed, the doc would see an update...but there is none   :(

ok, anyway:

1. Field:
NewComments
RT, editable

2. Field:
Comments
RT, computed
Formula: comments
(so computed in itself)

3. Youre LS Code

4. It works perfectly, without the third commentsdisplay field

Now, you can enter any comments to the first field "newcomments", saving it, whereas with every postsaving procedure the entries are logged to the comments field, which indeed is computed, therefore not editable afterwards. I still cant see the need for a third field.
« Letzte Änderung: 22.10.02 - 15:57:39 von Rob Green »
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
hmmm
« Antwort #10 am: 22.10.02 - 16:45:05 »
let's check this  ::)

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #11 am: 22.10.02 - 16:48:23 »
im a little bit curious...how does it come that you´re posting on a german board instead - seems easier to me, not that you think you´re not welcome  :)- on notes.net e.g., full of english speaking freaks?
« Letzte Änderung: 22.10.02 - 16:49:24 von Rob Green »
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
well...
« Antwort #12 am: 22.10.02 - 16:57:53 »
the code works like before.... as I said .... if I leave the code like this the user can modify and delete the whole content of the Comments field !

So if I use the CommentsDisplay field the user can't modify the Comments, he can saw the initial content of this field through the CommentsDisplay field and he can add some contents to this field through NewComments field!

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
english vs german !
« Antwort #13 am: 22.10.02 - 17:04:28 »
I work a lot with notes.net  :P but it seems that the english speakers on notes.net are little lazies  :P so I use this amazing forum (you and others like you are the reason that this forum is amazing) ! The Notes fan are everywhere  :D

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #14 am: 22.10.02 - 17:32:56 »
Zitat
the code works like before.... as I said .... if I leave the code like this the user can modify and delete the whole content of the Comments field !
There must be a mistunderstanding between us. How does the user can "delete" the contents of the "comments" field, since its computed in itself and not editable??

If you mean really this:
User enters in newcomments:
"We are Borg"

becomes after saving:
"we are borg" in comments (computed) AND
"we are borg" in commentsdisplay (editable in your version..little bit confusing for the user, dont you mean?)

now user edits doc by entering a new comment in "newcomments" field:
"Resitance is futile"

becomes after saving:
"we are borg resitance is futile" in comments (computed) AND
"we are borg  resitance is futile" in commentsdisplay

So, the field "comments" and "commentsdisplay" serves the same need. One is displaying the log/edit history as an editable RT field and the other as a computed RT field.

My last try: why dont use two fields?
Look here please (im very sure somehow i understand you wrong):
« Letzte Änderung: 22.10.02 - 17:33:38 von Rob Green »
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
...
« Antwort #15 am: 23.10.02 - 12:38:32 »
it seems that it works... I don't know what was in my head when I try to use a third field....  ???
thankx !  ::)

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Re:Modify a RTF field . Refresh it - Strange behaviour !
« Antwort #16 am: 23.10.02 - 12:43:26 »
the big emptiness or big happiness.... ;D ;D ;D

ok, just kidding...gratz!!!  :)
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
Rob ....
« Antwort #17 am: 23.10.02 - 17:39:52 »
thanks a lot .... again, Rob !

Regards

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz