Ticket #4961: newforms.diff

File newforms.diff, 770 bytes (added by Thomas Güttler <hv@…>, 17 years ago)
  • docs/newforms.txt

     
    13251325        senders = MultiEmailField()
    13261326        cc_myself = forms.BooleanField()
    13271327
     1328Adding HTML attributes to the widget
     1329------------------------------------
     1330
     1331If you want to add HTML attributes to the widget of a field, you need add
     1332them to the dictionary ``attrs``::
     1333
     1334    class ActionForm(forms.Form):
     1335        action=forms.ChoiceField(choices=(
     1336            ("", "---"),
     1337            ("edit", "Bearbeiten"),
     1338            ("delete", "Delete"))
     1339        action.widget.attrs["onchange"]="this.form.submit()"
     1340   
     1341
    13281342Generating forms for models
    13291343===========================
    13301344
Back to Top