| in this issue |
 |
 |
| |
How to Add a Built-In Pop-Up Calendar to your Application
by Brian Crowley
By popular demand, our Web/CGI maintenance templates now include the ability to specify a pop-up calendar for an input field. The application builder can customize many features of the calendar including the date format, calendar position, and all colors.
How to use the pop-up calendar
From the Application Options screen, select the Preformat screen (option 5.) Perform option 2 on the date fields in your application. Change the "User defined field control" to "C". Then recompile your application. The template will do the work of creating a pop-up calendar for each date field you have specified this way.
Customizing the functions
After compiling the application, you can modify many parameters controlling the functions of the calendar. Use STRPDM to modify library(Data Dictionary)/file(QHTMLSRC)/member(Mxxxxx) where xxxxx is the application number. Here are those parameters:
Click to enlarge
Some parameters are enclosed in quotes. Please keep those in quotes and the others not. Those in quotes are String values and the others are numeric variables.
Customizing the colors
Modify /mrcjava/mrcclasses/cal.js. Better yet, because mrc ships that file and your changes would be overridden by an update from mrc, copy that file to another name like mycal.js. Then, modify mycal.js and change your QHTMLSRC skeleton to point to mycal.js instead of cal.js. Near the top of the JS file, you'll find these customizable colors:
var bgColor = "#ffffff";
var cellColor = "#ffffff";
var headingFontColor = "#ffffff";
var headingColor = "#006488";
var buttonFontColor = "#006488";
var buttonColor = "#ffffcc";
var borderColor = "#006488";
var selectedColor = "#9c9c9c";
You may use the RGB values as we have or the valid color words. Valid color words include "white", "black", "blue", "green", etc.
Other uses
The calendar has uses beyond maintenance applications. Suppose you've built an inquiry application that contains a date as a sort field, and you wish to include a pop-up calendar for users of that application. No problem. Specifying "C" in the User Defined Field Control forces an extra 4 lines of code into the generated QHTMLSRC skeleton. Copy those few lines from a maintenance application into a retrieval's QHTMLSRC skeleton. Be sure to tell it exactly which form field to return the date value: K001, for example.
To see the calendar running live on the Web, visit our demo site: http://www.crazybikes.com/employees/I00220GC.mrc and select an order for update.
The pop-up calendar is just another of the many features available to users of the mrc-Productivity Series to help make the best Web applications possible.
|
|
|
|
|