PDF='MAIN' { ATTRIBUTES='*' { PLATFORM='php.txt'; REPTYPE='1'; ATTACHED='0'; PROJECT='36'; OBJECTNAME='calend.php'; LIBLOBJ='*FILES'; TITLE='Using a Popup Calendar to Select a Date'; WEBPATH='http://esdi.excelsystems.com/wsexmpphp/'; TARGETPATH='/www/zendcore/htdocs/examples/'; FTPSITE='examples'; SET='149'; VERSION='4.00'; CRTBNUM='Revision 1811'; CRTTEMPLT='C:\\Program Files\\ESDI\\WebSmart\\Temp\\PHP-A Simple Page.tpl'; SAVBNUM='Revision 1811'; LASTLOC='1'; VHTML='N'; LASTSAVE='12/13/2007 09:39:54'; OBJLIBRARY='WEBTEST'; SOURCELIBR='WEBTEST'; SOURCEFILE='QRPGLESRC'; } FTPREFINFO='*' { URL='192.168.0.100'; INITIALDIR='/www/zendcore/htdocs/examples/'; FTPPORT='21'; PASSIVEMODE='1'; WEBPATH='http://esdi.excelsystems.com/wsexmpphp/'; } PANELS='*' { PANEL='MainSeg' { DESC='Main Segment'; DETAILS=' Example 142: Using a Popup Calendar to Select a Date

Example 142: Using a Popup Calendar to Select a Date

Description:   This WebSmart PHP example demonstrates how to add a calendar to perform a date lookup.

  1. Select the \'Simple Page\' template.


  2. Choose all creation wizard defaults.


  3. Create two global variables. The $mydate variable will hold the selected date.
  4. global $mydate, $mydate_calpos;
  5. In your HTML, add a textbox to display the selected date.


  6. <form>
    <input type="text" name="$mydate" size="10" readonly>
    </form>
    Note:
    To prevent users from modifying dates without clicking on the calendar lookup,
    add the \'readonly\' property to the textbox.
  7. To add the calendar lookup:
    • Position your cursor to the right of the textbox field(after the \'>\' closing tag).
    • Right click and from the popup menu select \'Insert - Calendar Lookup\'.
    • Select the datefield by clicking on the \'...\'. In this case select the $mydate variable created in step 3.
    • Select the date format by clicking on the dropdown box and choosing the desired format.


  8. Generate and try your program.

Program Definition:   calend.phw

Rate This Example

Did this knowledge base article help you to achieve your goal?  Yes  No  Don\'t Know

Enter additional comments below.   If you want to hear back from us, include your contact information.

'; } } PREVIEWS='*' { DEFAULT='MainSeg'; PREVIEW='MainSeg' { SEG='MainSeg'; } } ACTIONS=' // Program Name: calendar_lookup.php // Program Title: Using a Popup Calendar to Select a Date // Created by: Todd Connick // Template family: Idaho // Template name: Simple Page // Purpose: // Program Modifications: require(\'/esdi/websmart/v6.6/include/xl_functions001.php\'); global $wsnum; //create an variable to hold the selected date global $mydate, $mydate_calpos; // This code is for the Rate this page section if (isset($_REQUEST[\'wsnum\'])) { $wsnum = $_REQUEST[\'wsnum\']; } // Check the cookie if(isset($_COOKIE[\'wsnumbc\'])) { $wsnum = $_COOKIE[\'wsnumbc\']; } else { setcookie(\'wsnumbc\', $wsnum); } // Retrieve the task (default to "default") if ($pf_task == \'default\') generic(); function generic() { wrtseg(\'MainSeg\'); } '; }