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.

This was first published in November 2008

Dig deeper on LotusScript

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close