|
|
|
|
|
|
|
|
|
|
|
|
|
|
Build a Domino pop-up calendar widget using formula language (continued)
FIGURE B
 
MyForm holds the field we want to update using the popup calendar. Roll over picture for a larger image.
Next, we need to add the popCal function to the form. Paste the following code at the top of the form before any links using the popCal function appear and make it pass through HTML (the line numbering is only used for reference in this article and should not be included in your actual code):
1 <script language="JavaScript">
2 function popCal(tField) {
3 window.open("/COMPUTEDTEXT/calpop?OpenForm&fName="+tField, "Calendar",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=200,height=200')
4 }
5 </script>
|
Lines 1 and 5 simply tell the browser that this is a block of JavaScript code. Line 2 creates a new function named "popCal" and assigns the value passed to it when it is called to the "tField" variable. Line 3 uses the JavaScript window.open command to open a new Web browser window and set a number of properties.
The COMPUTEDTEXT field appears in the URL being used to open the pop-up calendar and contains a single argument: @WebDBName, which evaluates to the Web browser path to this database. This makes this JavaScript function usable in any database on any server without modification.
The rest of the URL points to the calpop form and passes it the name of the field we want updated via "...calpop?OpenForm&fName=". On our sample form, tField will always have the value "MyDate", but multiple date fields are easily supported by changing the field name passed when calling the popCal() function.
Creating the calendar form Create a new form named "calpop" which we will use to hold the calendar. To get the parameter we are passing in the URL from the calling from, create a computed text field named upField and set its formula value to:
The first line retrieves the value of the URL parameter fName. In case no field name is passed in the URL, the second line defaults the value to a field named "DateVal".
Next, we need a field that will allow us to track a starting date for the calendar. By default, the calendar will use today's date as a starting point, but if the user should click the previous or next month (or year) links, we will need a field to keep track of the date required. This is the job of the DateVal field. Create a computed date field named DateVal and set the formula value to:
The first line retrieves the value of a parameter named sDate from the URL used to open this form. The second line either converts the value of sDate to a Domino time value or uses today's date. You can see how all this works in Figure C.
FIGURE C
 
The calpop form contains the calendar and navigation buttons laid out in a table. Roll over picture for a larger image.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!! |
-- Advertisement --
Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
- Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
- User friendly aproach, using a point and click access to features
- Reports from any Lotus Notes databases
- Runs reports through a Notes client, web browser and scheduled basis
- Allows use of LotusScript for advanced data manipulation
- Enables self service reporting capabilities to end-users
Learn more at www.integra4notes.com. |
|
|
|
|
|
|
|
|
|
|