Today is the first annual Yellow Day!
And I wear yellow, for sure.
In the spirit of this day, I want to
show you, how you can sidebar-enable your existing Notes applications without
using Java for the Notes 8.0.1 Standard client.
To add a view into the sidebar, is quite
easy - using the Widget toolbox buttons. But I needed an input form there,
to be able to create new documents conveniently all the time. In my case,
it's an application to input and control the times on projects and activities,
but it could as easily be a "Contact report" form of a CRM app
or the "Event log" form of an IT service app or ...
In the screenshot you can see the result.
You can only add views, documents or
frameset to the sidebar directly (at least without manually editing a Notes
URL: Creating
Form Design Element Sidebar Widgets).
Therefore I created a frameset called "Projektaufwand" (sorry
for not translating the design of the app, but I haven't the time right
now and it's not essential for understanding the technique itself). It
contains only one frame, in which a named element - the "Projektaufwand
(schmal)" form - is displayed. This is a narrow version of the standard
"Projektaufwand" form:
For the "installation" of
the frameset into the sidebar, you can temporarily change the start properties
of the database to open the "Projektaufwand" frameset, when opening
this app in the Notes client.
Then open the database. The frameset
and therefore the form are displayed, and the Widget toolbox buttons are
active now. Click on the third button:
The form is opened (in the invisible
frameset) in the sidebar. Additionally, a new widget is created in the
"My Widgets" section of the sidebar.
To add the created widget to the sidebar
on startup, you can set the appropriate property of the component:
This way, the form is available to conveniently
enter new documents all the time.
There is a small problem left: How do
you open a new, empty document in the sidebar after saving another one?
Honestly, I don't know.
But I found a workaround: The input
form contains a hidden text field "SaveOptions", which is "Computed
for Display" with a fixed value of "0". This way, documents
can't be saved directly.
Instead of writing an action in the
action bar, I created a button "Speichern" (Save), which creates
a new document in the back-end, copies all entered values and finally clears
the form to prepare it for the next input.
Sub
Click(Source As Button)
Dim
newDoc As NotesDocument
'
validate input
If
Not GetBaseController().IsModelValid() Then
Exit Sub
'
create a new document and copy items
Set
newDoc = currentDB.CreateDocument
Call
uidoc.Document.CopyAllItems(newDoc)
Call
newDoc.RemoveItem("SaveOptions")
Call
newDoc.ComputeWithForm(False,
False)
Call
newDoc.Save(True,
True)
'
clear this form
Call
ClearForm
Call
uidoc.Refresh()
End Sub
And that's it. Completely without Java
and Eclipse-Plugins you can sidebar-enable your applications for the current
Notes client.
By the way, you should adapt the design
of the form for the environment: The sidebar is (normally) opened narrowly,
thus the form's layout should be quite "vertical". You can optimize
it for the edit mode, and it doesn't need to print well.
You can see in the code of the Speichern
(Save) button, that I use the same model and controller classes as in the
standard "Projektaufwand" form. This way, the validation is guaranteed
to be the same, and you can maintain it in only one place.