- This form action script appends the phrase "Over here, balloon man!" to the Body field of the current document.
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Call uidoc.FieldAppendText _
( "Body", "Over here, balloon man!" )
End Sub
- This script appends today's date, the current user's name, and the contents of the Event field (each separated by spaces) to the Log field, when the user saves the document. The Event field is cleared.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Call source.FieldAppendText( "Log", Cstr( Date ) )
Call source.FieldAppendText( "Log", " " )
Call source.FieldAppendText _
( "Log", session.CommonUserName )
Call source.FieldAppendText( "Log", " " )
Call source.FieldAppendText _
( "Log", source.FieldGetText( "Event" ) )
Call source.FieldClear( "Event" )
End Sub
- This button script appends a new value to a text list. The script prompts the user for a string value. If the choices field is empty, the script adds the new string to the choices field. If the choices field already contains values, the script appends the new string to the choices field, preceded by a semicolon, which is the designated multi-value separator for the field.
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim currentChoices As String
Dim newChoice As String
Set uidoc = workspace.CurrentDocument
currentChoices = uidoc.FieldGetText( "choices" )
newChoice = Inputbox$( "Please enter a new choice: " )
If ( currentChoices = "" ) Then
Call uidoc.FieldSetText( "choices", newChoice )
Else
Call uidoc.FieldAppendText("choices", ";" & newChoice)
End If
End Sub