Skip to content

Add inline validation for preset fields with regex pattern#11925

Closed
Shyam-123pandey wants to merge 4 commits intoopenstreetmap:developfrom
Shyam-123pandey:feature/inline-field-pattern-validation
Closed

Add inline validation for preset fields with regex pattern#11925
Shyam-123pandey wants to merge 4 commits intoopenstreetmap:developfrom
Shyam-123pandey:feature/inline-field-pattern-validation

Conversation

@Shyam-123pandey
Copy link
Copy Markdown
Contributor

@Shyam-123pandey Shyam-123pandey commented Feb 25, 2026

valid

Add inline validation for fields that define a regex pattern

Summary

This PR adds inline validation support for preset fields that define a pattern (regex).

If a field includes a regex pattern and the entered value does not match it, an informational message is displayed directly below the input field.

Behavior

  • Validation runs on blur / change, not while typing.
  • The message appears only after the user finishes editing the field.
  • If the value becomes valid, the message disappears.
  • This does not block saving.
  • This does not create or modify issues in the issues panel.
  • It only applies to fields that define a pattern.

Why

Some fields may define a regex pattern but currently provide no direct feedback when the value does not match the expected format.

This change improves UX by giving contextual, field-level feedback after editing is complete, while staying consistent with iD’s existing interaction model (no validation on every keystroke).

Scope

  • Changes limited to uiFieldText.
  • No changes to the validation engine.
  • No preset/schema changes.

Closes #10769

Copilot AI review requested due to automatic review settings February 25, 2026 11:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds inline, non-blocking validation feedback for text inputs whose preset field definition includes a regex pattern, improving UX by showing/hiding a message as the user types.

Changes:

  • Add a validation message element to uiFieldText’s DOM structure.
  • Validate input values against field.pattern during change() and toggle the message visibility/text accordingly.

Comment thread modules/ui/fields/input.js
Comment thread modules/ui/fields/input.js
Comment thread modules/ui/fields/input.js
Comment thread modules/ui/fields/input.js Outdated
Comment thread modules/ui/fields/input.js Outdated
Comment thread modules/ui/fields/input.js
@Shyam-123pandey

This comment was marked as spam.

@Shyam-123pandey
Copy link
Copy Markdown
Contributor Author

Shyam-123pandey commented Feb 26, 2026

Good After noon Sir, Almost things have been resolved just check , I have doubt on one issue as copilot suggested please check above, so suggest for that.

@Shyam-123pandey

This comment was marked as spam.

@Shyam-123pandey

This comment was marked as spam.

Comment thread modules/ui/fields/input.js Outdated
@Shyam-123pandey

This comment was marked as spam.

@Shyam-123pandey

This comment was marked as spam.

@Shyam-123pandey

This comment was marked as off-topic.

@tyrasd
Copy link
Copy Markdown
Member

tyrasd commented Mar 19, 2026

While in general, it is probably worth exploring the options to show such validation warnings inline with the fields, the particular implementation does not seem to be very well thought through / matching the rest of our UI/UX patterns.

Closing until we have a better idea how we want to approach this in general

@tyrasd tyrasd closed this Mar 19, 2026
@Shyam-123pandey
Copy link
Copy Markdown
Contributor Author

Shyam-123pandey commented Mar 19, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show validation suggestion for non-matching field pattern

4 participants