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.
Problem/Motivation and Proposed resolution
we can see on this is screen what a day field is filled correctly, but it is marked as wrong, so only month and year fields should be to marked
this patch allow make a validation a more clearly, like screen
Related Issues
This changes was also supported into Webform Validation module (https://drupal.org/node/1913494#comment-7979391)
Comment | File | Size | Author |
---|---|---|---|
#8 | webform_validate_date_parts-2114983.patch | 1.86 KB | quicksketch |
#7 | webform_validate_date_parts-2114983.patch | 1.77 KB | quicksketch |
#6 | 2114983-validation-of-multi-valued-elements.patch | 1.88 KB | spheresh |
#1 | 2114983-separation-errors-marked-fields.patch | 1.04 KB | spheresh |
Comments
Comment #1
spheresh CreditAttribution: spheresh commentedComment #2
spheresh CreditAttribution: spheresh commentedComment #2.0
spheresh CreditAttribution: spheresh commentedRelated issue
Comment #2.1
spheresh CreditAttribution: spheresh commentedaslo
Comment #3
spheresh CreditAttribution: spheresh commentedComment #4
quicksketchThanks, this seems like a reasonable improvement. The code needs to be improved slightly for translation purposes. We shouldn't be trying to reassemble the word day/month/year from a non-translatable source. Instead we should give each field an internal label, or pull it from existing properties (like maybe #attributes['title']).
Comment #5
spheresh CreditAttribution: spheresh commentedHi @quicksketch. Thank you for response. I think you are right. I will take a little bit of time for research the question and make some improve, although an internal label sounds good.
Comment #6
spheresh CreditAttribution: spheresh commentedComment #7
quicksketchThanks @spheresh! While testing your patch I found that it would skip the remainder of the validation (such as invalidating Feb 30) because a "return" was being called in all situations:
I made the "else" an "elseif (count($errors))" to make it so the return is only called if there's a missing value.
I've committed this patch to the project. Please let me know if you encounter any issues.
Comment #8
quicksketchSorry this version was actually committed. The previous version has an issue with not throwing an error on a completely empty required date.
Comment #10
fenstratNeeds porting to 8.x-4.x.
Comment #11
fenstratCommitted and pushed 2a37061 and 12cf059 to 8.x-4.x. Thanks!