[Product-Developers] Re: Calender widget in custom view.

Swank, Craig Craig_Swank at nrel.gov
Mon Mar 3 15:29:35 UTC 2008


Dorneles,
Thank you.  I'm giving this a try now. I'll let you know how it goes.

Craig


On 2/29/08 1:13 PM, "Dorneles Treméa" <dorneles at x3ng.com.br> wrote:

> Hey swank,
> 
>> Is it possible to use any of the widgets of archetypes in a custom view?
> 
> in theory yes, you just need to supply the expected variables... :-)
> 
>> My view has some form inputs that let a user do some searching and
>> filtering on the fields of a certain content type.  One of the fields of
>> this content type is a date field, and I would like to use a calenderwidget
>> to enable the user to choose the starting and ending date for the filtering.
>> I don't want to use formlib and autogenerate a form because I want the
>> widget to appear in a table that I created as part of my view.
> 
> The calender widget macro, in truth, is not from Archetypes, but
> from Plone itself.
> 
> This snippet allows you to use it anywhere:
> 
>     <div tal:define="inputname  string:your_field_name;
>                      formname   string:edit_form;
>                      formvalue  request/your_field_name | nothing;
>                      fieldvalue here/your_field_name | python:'';
>                      inputvalue python:formvalue and formvalue or
> fieldvalue">
>         <div tal:content="error">Validation error output</div>
>         <div
> metal:use-macro="here/calendar_macros/macros/calendarDatePickerBox">
>             Gets the calendar code.
>         </div>
>     </div>
> 
> Of course, don't forget to add the necessary CSS/JS resources...
> 
> You can also set show_hm/show_ymd/... and all other parameters used
> by the calendar, take a look at the Archetypes calendar widget:
> 
> Archetypes/skins/archetypes/widgets/calendar.pt
> 
> HTH,





More information about the Product-Developers mailing list