=== Example ===
{{{
#!python
from django import forms
class FooForm(forms.Form):
a_date = forms.DateField(widget=forms.SelectDateWidget)
form = FooForm()
str(form) # >>> ...<select name="a_date_month" required
id="id_a_date_month"><option value="1">January</option>...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29056>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Stanislav Filin
* status: new => assigned
Comment:
I can fix this
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:1>
* version: 2.0 => master
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:2>
* cc: felixxm (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:3>
* owner: Stanislav Filin => Hasan Ramezani
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f038214d917c982613f5a15db8dfe325b1f7479b" f038214d]:
{{{
#!CommitTicketReference repository=""
revision="f038214d917c982613f5a15db8dfe325b1f7479b"
Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget.
placeholder is required for "select" with "required" attribute.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:5>
* status: closed => new
* version: master => 3.0
* resolution: fixed =>
* severity: Normal => Release blocker
Comment:
According to #31012 (which I just closed as a duplicated), the fix for
this ticket is not correct (and should probably be reverted).
There's more detail in the duplicate ticket but if I understand correctly,
the term "placeholder" in the spec does not refer to the "placeholder"
attribute that other tags can have.
A "placeholder" option is an `<option>` tag with an empty value that has
to be the first direct element of the `<select>`.
The duplicate ticket has a pull request at
https://github.com/django/django/pull/12116.
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:6>
* status: new => closed
* version: 3.0 => master
* resolution: => fixed
* severity: Release blocker => Normal
Comment:
HI Baptiste. The new ticket is highlighting a regression introduced here.
It's not a duplicate. But it will be a Release Blocker, yes. (I'm just
Reviewing it now...)
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:7>
Comment (by Carlton Gibson):
Worth noting for future reference from #31012:
> It's also important to note that the HTML generated for the
SelectDateWidget in previous versions of Django was valid per the HTML
standard. They did not contain a placeholder label option, but because
they were not a <select multiple> they always contained an option with a
selectedness set to true (usually the first option). This meant that the
required attribute generated for them was useless, since it would never
not have a value or be empty, but it did mean it was still valid HTML.
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"ee4a19053a32d41cdd79e087b1968980804ce658" ee4a1905]:
{{{
#!CommitTicketReference repository=""
revision="ee4a19053a32d41cdd79e087b1968980804ce658"
Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation of
required SelectDateWidget."
This reverts commit f038214d917c982613f5a15db8dfe325b1f7479b.
The initial issue was incorrect. Django 2.2, and before, did not
generate invalid HTML as reported. With f03821 in place invalid HTML
was generated.
Thanks to Kevin Brown for follow-up report and investigation.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:9>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"947f8e3485b1406d18ea062fd275c083d7ffbed5" 947f8e3]:
{{{
#!CommitTicketReference repository=""
revision="947f8e3485b1406d18ea062fd275c083d7ffbed5"
[3.0.x] Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation
of required SelectDateWidget."
This reverts commit f038214d917c982613f5a15db8dfe325b1f7479b.
The initial issue was incorrect. Django 2.2, and before, did not
generate invalid HTML as reported. With f03821 in place invalid HTML
was generated.
Thanks to Kevin Brown for follow-up report and investigation.
Backport of ee4a19053a32d41cdd79e087b1968980804ce658 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:10>
Comment (by Vlastimil Zíma):
When reported, the `SelectDateWidget` actually rendered invalid HTML, but
it was fixed as a side-effect of #29036. Looks like I've created this
ticket during the discussion and forgot to close it afterwards.
--
Ticket URL: <https://code.djangoproject.com/ticket/29056#comment:11>