Domino Code Fragment

Code Name*
Showing different Subforms on the Web
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.135.183.1
Description*
Sometimes a document might be to big or to confusing to fill out as one document on the web. One way to break up this document is to create multiple subforms, and on the submit of the form change the subform and reload the page. This method will involve a computed subform, the webquerysave or $$ querysaveagent event, and a field called ChangeSubForm. The Agent will assume that is the ChangeSubForm field equals SubForm2 then the document is finished and it should be submitted.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

ChangeSubForm field formula:
@IsNewDoc;"";ChangeSubForm)

Computed SubForm formula:
@IF(ChangeSubForm = "";"DefaultSubForm";ChangeSubForm = "SubForm1";"SubForm1";ChangeSubForm = "SubForm2";"SubForm2";"");

$$QuerySaveAgent/webquerysave

Sub Initialize
dim session As New NotesSession
dim webdoc as NotesDocument
set webdoc=session.DocumentContext

If webdoc.ChangeSubForm(0) = "SubForm2" then
Call webdoc.Save(True,False)
ElseIf webdoc.ChangeSubForm(0) = "" then
webdoc.ChangeSubForm = "SubForm1"
Call webdoc.Save(True, False)
Print "[http://domino.com/your.nsf/yourview/"+webdoc.UniversalID+"?Editdocument]"
ElseIf webdoc.ChangeSubForm(0) = "SubForm1" then
webdoc.ChangeSubForm = "SubForm2"
Call webdoc.Save(True, False)
Print "[http://domino.com/your.nsf/yourview/"+webdoc.UniversalID+"?Editdocument]"

End If
End Sub