The datepicker is handled client-side by code in /static/js/web2py.js:
http://code.google.com/p/web2py/source/browse/applications/welcome/static/js/web2py.js#28.
The datepicker attaches to fields with class "date" and "datetime" (and
there's a time entry widget for fields with class "time"). To disable the
datepicker, you could comment out that line or simply remove/rename the
/static/js/calendar.js file. Alternatively, you could use the server side
DOM to change the form field class to something other than "date".
Anthony
On Saturday, June 23, 2012 8:52:33 PM UTC-4, Don_X wrote:
>
> Hello friends,
>
> My problem is with the use of "select_datewidget" instead of the default
> popup date picker calendar !
>
> I need to use the select-datewidget that provides a dropdown date selector
> instead of the popup calendar ( as briefly proposed in the Web2py
> Application Dev. Cookbook, Chap. 5 page 171 )
>
> I copied the widget and in saved it in the models file db.py,
> the widget
> def select_datewidget(field,value):
> MINYEAR = 1910
> MAXYEAR = 2014
> import datetime
> ...
> ....
>
> just before the creation of the tables ... and after the db.define.table
> ('auth_user' ... )
>
> then, in the controller file default.py
> I created a test() function page like this :
>
> def test():
> form = SQLFORM.factory(db.auth_user,
> Field('birth_date','date',default=request.now,widget=
> select_datewidget))
> if form.process().accepted:
> response.flash = T('Quick Sign-up Accepted ! - Check your e-mail !'
> )
> elif form.errors:
> response.flash = T('Quick Sign up form has errors')
> else:
> response.flash = T('please fill out the Quick sign-up form
> correctly')
>
> return dict(quicksignup_form = form)
>
>
>
> "birth_date" is the name of my field defined in the table auth_user ( in
> db.py )
>
> for some reason ... when I put the form in the view file ( test.html )
> .... the select_datewidget does not work ... i still get the popup calendar
> datepicker !!! ...
>
> did anyone made use of this ??? .. can someone help me out here please ...
>
> my test.html file goes like this :
> similar to this :
> <h4 align="center">QUICK & FREE SIGN-UP </h4>
> <div style="text-align: center;"><em class="required">( **
> all fields are mandatory **)</em></div>
> <br />
> {{=quicksignup_form.custom.begin}}
> <div class="signupbox">
> <table>
> <tr>
> <td>{{=quicksignup_form.custom.label.first_name}} : </td>
> <td>{{=quicksignup_form.custom.widget.first_name}}</td>
> </tr>
> <tr>
> <td>{{=quicksignup_form.custom.label.last_name}} : </td>
> <td>{{=quicksignup_form.custom.widget.last_name}}</td>
> </tr>
> <tr>
> <td>{{=quicksignup_form.custom.label.email}} : </td>
> <td>{{=quicksignup_form.custom.widget.email}}</td>
> </tr>
> <tr>
> <td>{{=quicksignup_form.custom.label.password}} : </td>
> <td>{{=quicksignup_form.custom.widget.password}}</td>
> </tr>
>
> <tr>
> <td>{{=quicksignup_form.custom.label.sex}} : </td>
> <td>{{=quicksignup_form.custom.widget.sex}}</td>
> </tr>
>
> <tr>
> <td>{{=quicksignup_form.custom.label.usertype}} : </td>
> <td>{{=quicksignup_form.custom.widget.usertype}}</td>
> </tr>
>
>
> <tr>
> <td>{{=quicksignup_form.custom.label.birth_date}} : </td>
> <td>{{=quicksignup_form.custom.widget.birth_date}}</td>
> </tr>
> </div>
> </table>
> <div class="boxfooter">
> <table><tr>
> <td><input type="checkbox"></td>
> <td class="wrapping">I agree to the site's Terms of service,
> privacy policy, and codes of conduct.
> </td>
> </tr></table>
>
> <div class="tocenterfoot">
>
> <input name="submit" type="submit" style="font-style:normal;
> font-size:16px;color:#fff;" class="small blue nice button radius" value="Sign
> up Free »"/>
> </div>
> </div>
>
> {{=quicksignup_form.custom.end}}
> ...
> ...
>
>
> Can someone help me out here ... I don't want to use the popup calendar
> for the birth date ???
>
> thank you
>
> Don
>
>
>
--