Skip to content

iD date validation should be a validator rule, not an alert #445

Closed
OpenHistoricalMap/iD
#138

Description

@1ec5

As of OpenHistoricalMap/iD#81 for #280, when you enter a value into iD’s Start Date or End Date that doesn’t conform to the ISO 8601 date format, a modal alert box appears. Dismissing the alert clears the field, forcing you to reenter the whole value instead of fixing what was likely a smaller typo. This is inconvenient when working with a source in another tab of the same browser window: I have to remember to enter just the year but not the - before switching away to translate a month name in the source to a month number.

alert

iD’s other validator rules are more lenient. For example, the missing tags validator rule is classified as an error, which appears as a red box above the fields. The Issues panel lists any such errors, and you aren’t allowed to save the changeset until you fix the error:

error

upload

These proper validator rules are implemented outside of the field, in the validations/ directory. Proper validator rules can also catch malformed values that arise when using the raw tag editor, something the input field code can’t catch. It’s also possible to present the user with tips or quick fixes to deal with the issue. For example, there could be an option to delete the malformed date or, if it appears to be an EDTF date, move it over to start_date:edtf or end_date:edtf.

Replacing this modal alert with an inline error will also be helpful once we validate that end_date comes after start_date. Whenever I need to map a successor to a feature, I duplicate it, cut the End Date, and paste it into the Start Date. But doing it in another order should be OK too.

Activity

  1. bhousel commented on Sep 21, 2022

    @bhousel

    Worth mentioning too that post openstreetmap/iD#8243 you can now use URL parameters to override the validation rules, e.g. changing severity or disabling completely.

  2. 1ec5 commented on Oct 4, 2022

    @1ec5
    MemberAuthor

    OpenHistoricalMap/iD#138 replaced the alert with a proper validator rule. The PR landed in the new staging branch we’re working on for #395. GitHub hasn’t closed this issue automatically because staging-old is still this repository’s default branch; it’s waiting for us to merge staging into staging-old, which will never happen.

  3. 1ec5 commented on Oct 8, 2022

    @1ec5
    MemberAuthor
  4. added theissue type on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions