Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding a Field API Date field (for a Date of Birth), the clientside_validation doesn't work if no date is being entered ("required" validation).
I notice the same thing is happening in the demo here:
http://validation7.ubu001.attiks.com/examplesform?utm_medium=atix&utm_so...
Am I missing something, or is this a bug?
Comment | File | Size | Author |
---|---|---|---|
#2 | i1669570-2.png | 3.02 KB | attiks |
#3 | i1669570-2b.png | 3.64 KB | attiks |
Comments
Comment #1
attiks CreditAttribution: attiks commentedOn that page there's always a date filled in, so can you provide some more details.
Is this in a node/edit, webform, custom form?
Comment #2
attiks CreditAttribution: attiks commentedI tried this with a field on a node, but it renders without the * and after submitting it returns an error "A valid date is required for date." but I assume they changed something, to be continued ...
Screenshot is if you select required and no default value:
Comment #3
attiks CreditAttribution: attiks commentedI you specify a default value (i selected now), you'll get this
Comment #4
svendecabooterYeah the demo example is indeed already filled in. Didn't notice that, my bad :)
I have indeed a date field (granularity year - month - day) that has no default values.
It renders exactly as your screenshot in #2.
Comment #5
attiks CreditAttribution: attiks commentedDate moves the #required to the parent element, but that isn't really the right way to handle it, see #301538: Date field does not use #required to mark required date fields
This has to be fixed by the date module, sorry :/
Comment #6
attiks CreditAttribution: attiks commented