On Sat, Sep 5, 2009 at 1:52 PM, eli <eliasz.wont...@gmail.com> wrote:

>
> Hi,
>
> I have problem with Django Forms and field with set attrs to
> disabled="disabled"
>
> [snip]
> And now, Django remove values form field with attrs 'disabled':
> 'disabled' ("readonly" without "disabled" works fine, but I need
> disabled option in my html output). Why Django do that?
>
>
Django is not removing the values.  Rather the browser does not send to the
server values for form elements that are disabled when the form is
submitted. The HTML 4 spec here:
http://www.w3.org/TR/REC-html40/interact/forms.html#disabled notes in
discussing an example "Therefore, it cannot receive user input nor will its
value be submitted with the form."

By setting the element to disabled you have done essentially the same thing
as excluding it from the from (as far as Django can see), and you are
similarly responsible for supplying values for fields that are not contained
in the submitted form.  See the note here:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form

Karen

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to