#20684: Support form element attributes with no value
------------------------------+--------------------------------------
     Reporter:  sneethling@…  |                    Owner:  nobody
         Type:  New feature   |                   Status:  new
    Component:  Forms         |                  Version:  1.5
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------
Changes (by claudep):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> There are a couple of form attributes such as required that was
> introduced in HTML5 that should not contain a value. For exaple
> required="required" is valid but for example required="true" will result
> in failed validation with true being marked as a bad value.
>
> The correct use would be:
>
> <input type="email" required />
>
> Currently in forms.py attributes cannot be specified without a value
> which rely on the author knowing that a value of 'true' not being valid
> but 'required' being ok. it would be great if Django supports valueless
> attributes.
>
> Perhaps doing:
>
> widget=forms.TextInput(
>     attrs={
>         'required': ''
> }))
>
> will result in an input of:
>
> <input type="text" required />

New description:

 There are a couple of form attributes such as required that was introduced
 in HTML5 that should not contain a value. For exaple required="required"
 is valid but for example required="true" will result in failed validation
 with true being marked as a bad value.

 The correct use would be:

 {{{<input type="email" required />}}}

 Currently in forms.py attributes cannot be specified without a value which
 rely on the author knowing that a value of 'true' not being valid but
 'required' being ok. it would be great if Django supports valueless
 attributes.

 Perhaps doing:
 {{{
 widget=forms.TextInput(
     attrs={
         'required': ''
 }))
 }}}
 will result in an input of:

 {{{<input type="text" required />}}}

--

Comment:

 Description reformatted, please use preview when posting.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20684#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/080.5face5e9c9bf7f6ebccc96dae71c3d52%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to