On Aug 15, 2007, at 8:11 AM, emery_c wrote:

>
> I have been trying to get the CalendarDatePicker to work in pylons as
> well, using http://wiki.pylonshq.com/display/pylonscookbook/An 
> +Alternative+ToscaWidgets+Setup+with+Mako.
>
>> Are you sure you're using the render_response function provided in
>> toscawidgets.mods.pylonshf and passing all widgets to the template in
>> the c.w attribute?
>
> I believe I am. Both those steps are covered in the how-to I
> referenced above. It seems the necessary js files are being included,
> but the onclick function isn't being added to the button - apparently
> I missed a step someplace.
>
> The output html looks like this:
> <div>
> <input id="form_date" class="required calendardatetimepicker"
> type="text" value="2007/08/10 20:48" name="date"/>
> <input id="form_date_trigger" class="date_field_button" type="button"
> value="Choose"/>
> </div>
>
> The relevant controller code is:
>
>     def index(self):
>     c.title = "Add User Form"
>     c.w = WidgetBunch()
>     c.w.form = form
>     c.value = Person() # Testing class from example above
>     c.action = h.url_for(action='save')
>     return render_response('widget') # Mako
>
> I am using the AddUserForm from samples.py and the following code in
> widget template:
>
> % if c.input_values:
>     <h1>Validated data:</h1>
>     <dl>
>     % for k,v in c.input_values.iteritems():
>         <dt>${k}</dt>
>         <dd><pre>${repr(v)}</pre></dd>
>     % endfor
>     </dl>
> % elif c.w and c.w.form and c.action:
>     ${c.w.form.display(c.value, action=c.action)}
> % endif
>
>
> Any assistance would be appreciated.

A line like this should be rendered at the bottom of <body>:

Calendar.setup({"ifFormat": "%Y/%m/%d %H:%M", "button":  
"form_date_trigger", "showsTime": true, "inputField": "form_date"});

If it is missing, maybe you forgot to add something like this in  
templates/base.tmpl?:

<html>
     <head>

         % for rsrc in c.resources.get('head', []):
             ${rsrc.display()}
         % endfor

     </head>
     <body>

         % for rsrc in c.resources.get('bodytop', []):
             ${rsrc.display()}
         % endfor

         ${next.body()}

         % for rsrc in c.resources.get('bodybottom', []):
             ${rsrc.display()}
         % endfor

     </body>
</html>


Alberto




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to