views:

2401

answers:

1

Hi, I have this simple form:

class PagoDesde(forms.Form):
    from django import forms as f
    desde = f.DateField(input_formats=['%d/%m/%Y'])

In my template:

    {{ form.desde }}

And has associated a jqueryui.datepicker in the document.ready

    $("#id_desde").datepicker();

The html result is:

<input type="text" id="id_desde" name="desde" 
class="hasDatepicker" gtbfieldid="598"/>

And it works great, but I have

2 questions:

  • what is gtbfieldid="598"? does jquery add that?
  • how to avoid the autocomplete behavior of the browsers in this textfield?

thanks :)

+8  A: 
  1. I think gtbfieldid is coming from google toolbar.

  2. Use autocomplete="off". This attribute is not standard XHTML, so you'll fail validation but it's useful functionality.

Here's how you'd set the autocomplete attribute:

class PagoDesde(forms.Form):
    from django import forms as f
    desde = f.DateField(input_formats=['%d/%m/%Y'],
                        widget=forms.TextInput(attrs={'autocomplete': 'off'}))
SmileyChris
thx for the complete info :)
panchicore
I just wanted to add my editorial comment, google should be shot in the face for not expanding the g to 'google'. What a waste of time. On the flip side, FF should be shot in the face for not coloring the attribute differently or indicating that it was added through script.
Evan Carroll
And, thanks for coming up in my google search. ;)
Evan Carroll