Create Calendar Helper in m-Painter
With the February 15, 2010 m-Power update, the calendar picker has been significantly improved. Additionally, it is now easier to implement into your applications. With this update, you no longer specify within Field Settings that you want to create a calendar helper. Instead, all you need to use is m-Painter!
To implement this functionality in your application, open m-Painter. Click on the input field to which you would like the calendar functionality applied. Either select the “Insert Calendar” button from the m-Painter toolbar or right-click on your input field, and select “Insert/Edit Calendar”.
If you see the below error message, it means you did not first select an input box before creating your calendar. Therefore, m-Painter does not know which input your calendar should belong to and throws the message you see below:
Once you have specified an input box, you will be shown this dialog box. Each option is outlined below:
Select a date format — You must select the format that matches your date’s format in the database. The list below contains all valid options and also an example of how a sample date (July 4, 2010) would be represented for each format:
- ymmdd (100704)
- mmdd (20100704)
- yy-mm-dd (2010-07-04)
- yy/mm/dd (2010/07/04)
- mmddyy (07042010)
- mm/dd/yy (07/04/2010)
- mm-dd-yy (07-04-2010)
- mmddy (070410)
- mm/dd/y (07/04/10)
- mm-dd-y (07-04-10)
- ddmmy (040710)
- dd/mm/y (04/07/10)
- dd-mm-y (04-07-10)
- ddmmyy (04072010)
- dd/mm/yy (04/07/2010)
- dd-mm-yy (04-07-2010)
- dd-M-yy (04-JUL-2010)
- dd-M-y (04-JUL-10)
- yy-M-dd (2010-JUL-04)
- y-M-dd (10-JUL-04)
You’ll notice that references with “Y” indicate a 2 digit year, whereas a reference with “YY” indicates a 4 digit year.
Min Date & Max Date — These two input boxes are useful if you want to limit the user to selecting dates within a range. For instance, specifying “-30″ in the Min Date input & “+30″ in the Max Date input forces your user to select a date within the past 30 days through a date 30 days in the future.
# of Months — This feature allows you to control the number of months that appear when a user selects the pop-up calendar. By default, the option is 1 month at a time; however, the current maximum number of months to see simultaneously is 4. Below is an image that illustrates setting this feature to “2″.
Show Month/Year Selections? — This feature, when checked, allows the user to quickly switch to a different month or year, rather than paging through each month.
Apply to Field — This option tells m-Painter which input box owns the calendar picker. The value in this input box is decided by which field you clicked on when you created the calendar picker and does not need to be modified.
Once you have made all the changes you would like, please click “Save”. Run your application.
Release notes
- The method of creating calendar helpers with the User Defined Field Code of “C” will continue to work to support older applications, but has been deprecated.
- If specifying min and max date, you must enter “-” and “+” within the respective input boxes.
- If an end-user selects “Today” from the calendar, they will be returned to the current month. However, no date will be returned to the form unless directly clicked on.
- m-Power ships with 20 of the most popular formats. However, you have the option to customize your date format by ignoring the “Select a data format” drop-down list, and instead typing in your own format into the “Selected Format” input box. Your date format can be combinations of the following:
- d – day of month (no leading zero)
- dd – day of month (two digit)
- o – day of year (no leading zero)
- oo – day of year(three digit)
- D – day name short
- DD – day name long
- m – month of year (no leading zero)
- mm – month of year (two digit)
- M – month name short
- MM – month name long
- y – year (two digit)
- yy – year (four digit)
- ! – Windows ticks (100ns since 01/01/0001)
- @ – Unix timestamp (also known as epoch seconds or POSIX time) in milliseconds since 01/01/1970
- ‘…’ – literal text
- ” – single quote
- anything else – literal text
