?
Solved

Adding Doclink to richtext field, reopen document in edit mode with double clicking restriction.

Posted on 2006-10-26
11
Medium Priority
?
835 Views
Last Modified: 2013-12-18
dear Experts,

I would like to do the following.

Create a new document(b) .
Create doclink on a richtext field for document (b) on uidoc.
Close doc, open doc for doclink to appear immediately.
Set Document to edit mode.
Change field value.

My problem is : when i reopen the document after successfully creating the doclink, the system would not allow me to change to edit mode. Yes, i have scripts in POStOPEN and QUERYMODECHANGE to prevent double clicking edit. The message that prompts was the message i used to disable double clicking editing.

EditMode = uidoc.EditMode
                        
                        
                        uidoc.Close
                        
                        
                        Set rtitem5 = doc.GetFirstItem("link_0")
                        If ( rtitem5.Type = RICHTEXT ) Then
                              
                              Call rtitem5.AppendDocLink( newdoc , "Doclink" )
                              doc.Form = "f-requestform"
                              
                              Call doc.Save( False, True )
                        End If
                        
                        Set uidoc = workspace.EditDocument( EditMode , doc )
                        
                  End If
            End If
            
            Messagebox "This item has been mark as processed.", , _
            "Ittem Filled"      
            
            
            
            allowEdit = Cint(1)
            uidoc.EditMode = True
            
            Call uidoc.FieldSetText("status" , "Partial Processed")
0
Comment
Question by:Leepingtang
[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
  • 2
  • 2
  • +1
11 Comments
 

Expert Comment

by:LordMacBee
ID: 17817697
if you have a script preventing edit mode then you cant change to edit mode. That restriction doesnt just prevent the user the go to edit mode but also any script doing so.
0
 

Author Comment

by:Leepingtang
ID: 17817785
But i have the same script that works on a button. Is this a constrain?
0
 

Expert Comment

by:LordMacBee
ID: 17817846
I can't quite see from your code what you are trying to achieve...
firstly, the messagebox doesnt seem to be in any way connected to the edit mode and thus is called every time. there are two 'end if' statements without the initial if statement.
secondly, it's hard to guess what else is going on in the document. Can you post the QuerySave / QueryModeChange scripts as well? Or is this code from those event handlers?

Maybee if you post the whole code...
0
Independent Software Vendors: 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!

 

Author Comment

by:Leepingtang
ID: 17817966
Sorry LordMAcBee, the code that i have pasted is an abstract only.

let me explain myself again.

I have the following codes to stop editing by double clicking on the form. ( forces user to use the action button that enables the form to be in edit mode. )

Sub Postopen(Source As Notesuidocument)
      If source.EditMode And Not source.IsNewDoc Then
            allowEdit = True
            source.EditMode = False
            Messagebox "Please press the Edit button to edit.",64,"Edit"
      Else
            allowEdit = False
      End If
End Sub


Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
      If allowEdit Or (source.EditMode And Not allowEdit) Then
            allowEdit = False
      Else
            Messagebox "Please press the Edit button to edit.",64,"Edit"            
            continue = False
      End If
End Sub


On event of a click on a button, a new document will be created. I want to be able to create a doclink to this newly created document and make it visible right after the click. so i have to close uidoc and add the doclink on the background. Then reopen the document once again. My problem lies here. I want to re-open the document that i have closes in EDIT MODE so user can make further changes.



'doc is close here
uidoc.Close
                        
                        'add doclink from background
Set rtitem5 = doc.GetFirstItem("link_0")
                        If ( rtitem5.Type = RICHTEXT ) Then
                              
                              Call rtitem5.AppendDocLink( newdoc , "Doclink" )
                              doc.Form = "f-requestform"
                              doc.status = "Partial Processed"
                              doc.d0_status = "P"
                              Call doc.Save( False, True )
                        End If
                        
                        'reopen doc and set as uidoc
Set uidoc = workspace.EditDocument( False , doc )
                  End If
            End If
            
            Messagebox "This item has been mark as processed.", , _
            "Ittem Filled"      
             allowedit = True
                                 uidoc.Editmode = true

' My predefined message appears once the code is executed to the above line, forcing users to use the edit button for modification. I want to bypass that so that users do not have to click on the EDIT button again.
0
 
LVL 63

Accepted Solution

by:
SysExpert earned 80 total points
ID: 17819935
DO not use the uidoc front end, you need to get the doc handle and use backend procedure to reopen it

I hope this helps !
0
 

Author Comment

by:Leepingtang
ID: 17824938
I think  i know where you are coming from, will give it a try and let you know! Gracias mucho!!
0
 

Author Comment

by:Leepingtang
ID: 17830965
sysExpert, can you provide more details?
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17842521
OK, apparently backend classes will not work for you since they bypass the UI and you want to reopen the doc for editing.

If that is th case, then I would simly add a hidden field with a flag that tells you that you have saved and are re-opening the doc.
If the flag is set then do Not prompt.

you already have

doc.d0_status = "P"

and you can check that to bypass the Edit prompt, or use another hidden field.

Make sure the default of the field is known and that you change it as needed.

I hope this helps !


0
 
LVL 18

Expert Comment

by:marilyng
ID: 17973043
In addition to trapping the doc.d0_Status="P" on the post open, querymodechange, and postmodechange,

change the line: Set uidoc = workspace.EditDocument( False , doc )
to:  Set uidoc = workspace.EditDocument( true , doc )


I found that when trying to track these, you need to set a status based on the button being pushed.  The Notes Mail file script library does this, actioninprogress = PUSH_SAVE

So, if you roll your query events into a script library and attach some constants to all events, then you can step through using a select case actioninprogress

Some Constants:
Const  SAVECONTINUE = 21
Const  SAVECLOSE = 20
Const  CLOSENOSAVE = 99
Const  SAVEREOPEN = 50

So, when you have an action button like: Save & Close
The first thing it does is set the actioninprogress field,  this way you know which button was pressed.  You default the button to SAVECONTINUE when the document opens in edit mode.

FIELD ActioninProgress:=50;
@if(@Command([FileSave]);@SetField("ActionInProgress";20);"")

So, the first FIELD sets the actioninprogress field to your SAVEREOPEN value, and the second one changes it so the user can close when they finish a second time.

The PostOpen, QueryModeChange, PostModeChange then can use either a combined script library or individual calls to check the value of actioninprogress:

Select Case ActioninProgress
 Case SAVEREOPEN
    do this
    do that
    do this
  Case SAVECLOSE
    Do something else
    Do another thing
   case Else
     etc.
end select

Also, when going from UI to backend, it helps to destroy the uidoc,
uidoc.close
set uidoc = nothing

But if you do this, and then change the ws.editdocument(true, doc)  it should work.  


The other nice thing about the actioninprogress field is that you can use hidewhens nicely.. actioninprogress!=50

See if this helps you.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

771 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