you need to override event_handlers(). Basically just copy the 
event_handlers function to your own with $.web2py.event_handlers, and 
rewrite the part that attaches the calendar to input.date, input.datetime 
and input.time .
There's an example 
on 
https://github.com/niphlod/cs_monitor_plugin/blob/master/static/plugin_cs_monitor/js/app.js
 
(using https://github.com/Eonasdan/bootstrap-datetimepicker/)

On Thursday, October 8, 2015 at 1:57:55 AM UTC+2, Edward Shave wrote:
>
> I want to use a different datetimepicker 
> <http://xdsoft.net/jqplugins/datetimepicker/> widget so I need to disable 
> the old one. 
>
> So far I've commented out the following two lines in web2py_ajax.html...
>
> response.files.insert(1,URL('static','css/calendar.css'))
> response.files.insert(2,URL('static','js/calendar.js'))
>
> That did the trick but it breaks some code in web2py.js which silently 
> fails due to Calendar not defined!
> Before I go messing with any more files maybe someone knows a nice clean 
> way to disable the calendar widget?
>
> By the way, with just a few lines of code the new one seems to be working 
> fine in a SQLForm.
>
> I new what needed to go in the code below but not really where to put it. 
> For example should the file links be in the header?
> And is the document.ready function needed?
> Anyway it works so hopefully it' will do until I get more experienced.
>
> db.define_table('cal_form',
>     Field('date_in','date'))
>
> def datepicker():
>    form=SQLFORM(db.cal_form)
>    if form.process().accepted:
>        response.flash = 'form accepted'
>    elif form.errors:
>        response.flash = 'form has errors'
>    else:
>        response.flash = 'please fill out the form'
>    return dict(form=form)
>
> {{extend 'layout.html'}}
> {{block head}}
>     <link rel="stylesheet" type="text/css" href=
> "/calendar/static/css/jquery.datetimepicker.css"/ >
>     <script src="/calendar/static/js/jquery.datetimepicker.full.min.js"></
> script> 
> {{end}}
> <h2>Input form</h2>
> {{=form}}
> <script>
>     $(document).ready(function(){
>         jQuery('#cal_form_date_in').datetimepicker({
>             timepicker:false,
>             format:'Y-m-d',
>             yearStart: '1940'
>         });
>     });
> </script>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to