Manage Learn to apply best practices and optimize your operations.

Entering Data Directly in a Web View

For Web/Intranet applications it is sometime useful to be able to edit document in a view without having to open/edit the document. You could do that by letting user edit document in views. This only works for Web application. I use R5 but I believe it could works with older version.

---------------------------------------------------------
1 - Create a view with the following formula in the column(s) you want to be editable where FIELD_NAME is the name of the field.(see below)

2 - Embed this view on a page (or create a view template). In the JavaScript put the JavaScript AddChange function (see below) and put a SAVE & NEXT button, that will trigger the following JavaScript:
parent.CHANGE_FRAME.document.forms[0].submit()

3 - Create a form with a field named "CHANGE" and a SaveOptions field =0. The change field should allow multiple values separated by a ";". The Web Query save of the form will be set for the LotusScript code to run. (see below)

4 - Create a Frameset with two frame. One of them should be called "CHANGE_FRAME" and should contains the form created in three. Edit the page (point 2) so that it always start in the other frame.

Here it is... Just call the page in your browser and it should works! Be careful that there is no more field validation: if you need some add it in the JavaScript addchange function.


Here is the JavaScript AddChange function:

function AddChange(fieldid,val)
{
curval=parent.CHANGE_FRAME.document.forms[0].CHANGE.value;
newval=curval+fieldid + "#"+val + ";";parent.CHANGE_FRAME.document.forms[0].CHANGE.value=newval;
}

-------------------------------------------------
Here is the code for the QuerySave agent (LotusScript):

Dim doc As NotesDocument
Dim view As NotesView
Dim db As NotesDatabase

Sub Initialize
Dim session As New NotesSession
Dim change As NotesItem
Dim docid As String
Dim fieldname As String
Dim newval As String

Set doc = session.DocumentContext
Set db =session.CurrentDatabase
Set change=doc.GetFirstItem( "CHANGE")

If change.values(0)="" Then Exit Sub

Forall v In change.Values
docid=Strleft(v,"@")
fieldname=Strrightback(Strleftback(v,"#"),"@")
newval=Strrightback(v,"#")

Call changedoc( docid, fieldname, newval)
End Forall

Print "address you want to go after submit"
End Sub

Sub changedoc( id , field , value)

Dim doctochange As NotesDocument
Dim fieldtochange As notesItem
On Error Goto Probleme

Set doctochange=db.GetDocumentByUNID( id )
Set fieldtochange=doctochange.GetFirstItem( field)

fieldtochange.values=Val(value)
Call doctochange.save(False,False)
Exit Sub

Probleme:
Print "Error number :" & Str$(Err)

End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close