Most Lotus Notes Domino date pickers are tied to a specific field; however, there is a way to use a date picker that isn't associated with a specific field. With just a few adjustments, you can use Domino's embedded date picker and dialog box to do this.
The trick here is that every time you change the value of your embedded date picker, three items are updated: $DatePickerDay, $DatePickerMonth, $DatePickerYear. Use these fields to obtain the day, month and year of your selected day in your embedded date picker.
Here are a few additional steps to ensure this works correctly:
- Code a button that creates a temporary Lotus Notes document and opens a dialog box. This dialog box will use the temporary document as a parameter.
- Create a dialog form that includes an embedded datepicker element, as well as a computed field for the date chosen from your $DatePickerDay, $DatePickerMonth and $DatePickerYear fields.
- Append the corresponding values from the current date in the $DatePickerDay, $DatePickerMonth and $DatePickerYear fields in the PostOpen of your dialog form and mark your SaveOptions item as "0."
- Save your work. This button should allow you to pick a selected date, month and a year or a computed field with the date from temporary document items.
- Next, modify the following fields in your dialog form to editable numbers: $DatePickerDay, $DatePickerMonth and $DatePickerYear.
- Save the form and close it.
- Re-edit the form and delete the aforementioned fields.
Place this LotusScript code in the button created in Step 1. This will open the dialogbox with a dialog form that includes your embedded date picker.
Use this code in the date picker dialog form's QueryOpen event.
Finally, here is some sample code for the computed field of the date picker dialog form, which adds the day, month and year to the date value.
@Text($DatePickerDay) + "." + @Text($DatePickerMonth) + "." + @Text($DatePickerYear)
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Petri Niemi. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.