Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
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:

FieldVal:=@UrlQueryString("fName");
@If(FieldVal="";"DateVal";FieldVal)

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:

strDate:=@UrlQueryString("sDate");
@If(strDate="";@Date(@Today);@TextToTime(strDate))

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.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- 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.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login