Monday, November 28, 2011

Re: better datepicker

Hey,

I use http://docs.jquery.com/UI/Datepicker on the front end.

It's as simple as placing $("#datepicker").datepicker(); inside the page where you want to convert the text fields to date picker fields. I'll you have to do is change the ID inside $("#datepicker").datepicker(); to an ID of your field. e.g. change $("#datepicker").datepicker(); to $("#your_field_id").datepicker();

You can also use a class as a selector if you have multiple fields.

To change the format use $("#your_field_id").datepicker({ dateFormat: 'yy-mm-dd' }); or $("#your_field_id").datepicker({ dateFormat: 'dd-mm-yy' }); in your case

I hope that helps!

On 29 November 2011 03:32, marjenni <mark.jennings.email@gmail.com> wrote:
Hi,

class SearchForm(forms.Form):

       date         = forms.DateField(required=True,
input_formats=('%d/%m/%Y',))


I am trying to change this so that it displays a calendar when the
user starts to enter a date.
I have seen various examples using JQuery, but I can't find an example
that explains what I have to do quite clearly enough. Ideally I would
like to use a date range picker.

many thanks

Mark

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment