Manage Learn to apply best practices and optimize your operations.

Create a non-specified date picker with LotusScript code

Have you been searching for a way in your Domino environment to use an embedded datepicker in a dialog box that isn't associated with a specific field? Here's a solution that uses Domino's current datepicker and dialog box, some LotusScript code and a few simple modifications.

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:

  1. 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.
  2. 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.
  3. 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."
  4. 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.
  5. Next, modify the following fields in your dialog form to editable numbers: $DatePickerDay, $DatePickerMonth and $DatePickerYear.
  6. Save the form and close it.
  7. 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.

LotusScript to code button for datepicker
(Click on code for enlarged view and script download.)

Use this code in the date picker dialog form's QueryOpen event.

Code to use in Queryopen event
(Click on code for enlarged view and script download.)

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.

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close