plainblack.com
Username Password
search
Bookmark and Share

YUIDateChooser

Package WebGUI::Macro::YUIDateChooser

DESCRIPTION
Macro for displaying a YUI (http://developer.yahoo.com/yui/) popup calendar attached to an input tag as specified by input_field_name.

process ( [libs], input_field_name, [calendar title], ["options"]  )

       libs string

       Includes the required popup calendar and style libs.

       An optional string containing the pattern "libs" which should be used only once in the page layout Metadata

       "Extra <head> elements (tags)" field.  Ex:  ^YUIDateChooser(libs);

       when specifying libs as the first parameter you can also specify a javascript validation filename
       relative to the extras directory as the source of the Date.IsValid function. 
       Ex:  ^YUIDateChooser(libs, date.js);

input_field_name string

       The input tag field name.

       Ex:  ^YUIDateChooser("",requested_date);

       generated tag:  <input type="text" id="requested_date"  name="requested_date" style="position:static;"/>

"calendar title" string

       The title of the calendar.

       Ex:  ^YUIDateChooser("",requested_date,"Service date:");

"options" string

       Extra options that will control date validation..

       Ex:  ^YUIDateChooser("",requested_date,"","required:true,validation:true");

         options:

             required:[true‚false]   default = false
             if set to true the input tag must contain a value
             validation:[true,false]  default = false
             if set to true the input tag must contain a valid date

 TODO: 

  • Input tag validation (required/proper date/etc...) - DONE! Cool
  • Float the calendar to the right of the input tag (proper flow) - DONE!  Cool
  • Internationalize (i18n) - Done!  Cool

Setup:

    The distributed zip file has the proper directory structure for WebGUI.  Make sure you download and pass date.js as the second parameter to libs.

Troubleshooting:  If you get javascript page errors such as: 

           Date.isValid is not a function

Make sure you have downloaded and included the date.js!

System Requirements

I have not included the date validation source file.  You can get that from here:

date.js http://www.javascripttoolbox.com/lib/date/index.php

Download the file and place it in this location /data/WebGUI/www/extras/date.js

Then simply include it as part of the libs call.

^YUIDatePicker(libs,date.js);

Comments
2fathertorque: "Cool thank you!Once i8n and todos are done it would be wonderful to add this into the webgui core both to replace the old dhtml calendar and as a standalone macro."
4dannymk: "
Hmmm... Date validation seems to be a bit of a problem.  I am hoping I can get it done with the yui-ext package (YAHOO.ext.grid.DateEditor).  I will have to look into it a bit.

Update:  Unfortunately I could not get it done with the YUI-EXT package.  However I found a library on the web (included) that does the job. 
"
3dannymk: "Date validation is optional in this version."
DownloadDatePicker.zip DatePicker.zip
LinksDaniel Maldonado
No Support Offered
Statistics Downloads: 599
Views: 4689
Rating: 3
Updated: 9/14/2011
Keywords macros
NavigationMore from Daniel Maldonado
Back to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved