Tip

Create a non-specified date picker with LotusScript code

Most Lotus Notes Domino date pickers are tied to a
Related resources from SearchDomino.com:
Set date without time via LotusScript

Tutorial: 30 LotusScript tips

LotusScript Learning Guide

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.