Manage Learn to apply best practices and optimize your operations.

InViewEdit for the Web

This tip shows you how to use InViewEdit functionality on the Web.

InViewEdit functionality, introduced in R6, was a cool addition to Notes features. It was designed to enhance features available for Notes client. With most of the recent Domino applications being developed for the Web, it would be useful to mimic this functionality for Web applications.

By using a few age old techniques of Domino development, we can easily bring this concept into Web applications.

For example, lets take a small Web-based call management application that has a form for logging calls. It has a status field, which depicts the status of call. Now the helpdesk agent who accesses this application from the Web should be able to change the status from Web view.

  1. Create a view that will have HTML code put in their column formulas.

    Have the first column hold the UNID of the document.

     Col1 – 
     "<tr><td width='30'>
    <input type='hidden' name='Docunid_" 
    + @Text(@DocNumber) + "' value='" + 
     @Text(@DocumentUniqueID) + "'></td>"
     Col2 – Will display the name 
    of person to whom the call is assigned.
     "<td>"+  EnggName +"</td>"
     Col3 – Will hold the problem description
     "<td>"+problem + "</td>"
     Col4 – Will hold the HTML 
    for editable Status field
     Rem {
     StatusOptions – is a fieid in the 
    form which will hold the various 
    options available for status field
     Onchange event of status field we are
     calling a function which should 
     be declared in the view template we will use for this form
     newList := @Transform(StatusOptions;"var";
     @If(var = Status ; "<option selected>" + var 
    + "</option>";"<option>" +  var+ "</option>"));
     "<td><select name='Status_"
    +@DocNumber+"' onchange='saveRecord
    (""+@DocNumber+"");' >" 
     + @Implode(newList) + "</select></td></tr>"

  2. Create a view template for the previous view (Form named $$ViewTemplate for YourviewName).

  3. Add server_name cgi hidden field and a hidden field (webDB) with formula as @WebDbName.
     Add a table tag
     <table width="450" border=1>
      <!-- $$ViewBody field here goes here 
     Create Iframe 
     <iframe ID="agentOutput" height="50" 
    width="800" frameborder="0" 
    scrolling="no" src=""></iframe>
     In the JS header define the saveRecord function
     function saveRecord(docNumber) {
      var server = document.forms[0].Server_Name.value ;
      var dbpath = document.forms[0].webDB.value ;
      var docID = eval('document.forms[0].Docunid_' + 
    docNumber + '.value');
      var Status = eval('document.forms[0].Status_' + 
    docNumber +
       '.options[document.forms[0].Status_' + docNumber 
    +' .selectedIndex].text');
      var agentPath = "//" + server +"/" + dbpath + "/saveDoc?
    openagent&unid=" +
        docID + "& Status=" + Status;
      document.getElementById("agentOutput").src = 
    agentPath ;
  4. Create an agent "saveDoc" to save the document specified by UNID in the agent URL.
     Sub Initialize
      On Error Goto errHandler
      Dim session As New notessession
      Dim db As NotesDatabase
      Dim contextDoc As NotesDocument
      Dim doc As NotesDocument
      Dim tmp As String
      Dim strUnID As Variant , strStatus As Variant
      Set db = session.CurrentDatabase
      Set contextDoc = session.DocumentContext
      tmp = contextDoc.Query_String_Decoded(0)
      strUnID = Evaluate
      strStatus = Evaluate
      Set doc = db.GetDocumentByUNID(strUnid(0))
      If Not doc Is Nothing Then
       doc.Status = strStatus
       Call doc.Save(False,False)
       Print "<b>" + doc.EnggName(0) + "'s call Saved 
      End If
      Exit Sub
      Print "<b>Save failure: Error while saving the 
     End Sub

When the view is opened in the Web, Domino displays the view using the View Template we created. Now, when the user changes the status, saveRecord function is called, which calls the agent "Savedoc" and passes the UNID of the current doc and new status value as URL parameters. The agent gets these values and saves the changes in the corresponding document.

If you need to edit more than one field, then just append those values to the agent URL, access those values in the saveDoc agent and save those values in the backend document.

If you don't want the user to see the saveDoc agent output, reduce the width and height of Iframe to "0". Instead of using Iframe, you also make use of the popup window (create a new window and make its URL to agent URL).

Instead of using HTML in the view column, you can create a simple view and then create a form with a rich text field. In the Webqueryopen agent of that form, access the View, generate the required HTML and put this HTML string into the rich text field.

You will then need to add the JavaScript function to call the agent to save the changes in document and Iframe to display the agent output.

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Amar Deep Bhupathy. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Web Development for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...