WebGUI
      Click here to register.
      
PBWG Banner

YUIDateChooser

User: dannymk
Date: 8/4/2007 10:47 am
Views: 864
Rating: 7    Rate [
|
]

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");

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");

         options:

             required:[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 include the DateValidationLib.js file in the meta tags.  The best place to put the script tag is in the page layout "extra head elements (tags)" in the form <script src="^Extras(DateValidationLib.js);"></script>.

Troubleshooting:  If you get javascript page errors such as: 

           Date.isValid is not a function

Make sure you have included the DateValidationLibs.js in your head tags. 



Replies

Re: YUIDateChooser
User: fathertorque
Date: 8/6/2007 4:59 am
Rating: -9    Rate [
|
]
Status: Approved
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.

Re: YUIDateChooser
User: dannymk
Date: 8/6/2007 9:58 pm
Rating: 10    Rate [
|
]
Status: Approved

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. 


PreviousBackNext