Skip to content

Require country code on phone numbers - #160

Open
iandees wants to merge 1 commit into
gh-pagesfrom
phone-country-code-validation
Open

Require country code on phone numbers#160
iandees wants to merge 1 commit into
gh-pagesfrom
phone-country-code-validation

Conversation

@iandees

@iandees iandees commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #94.

Per the discussion on #94, a full libphonenumber integration is overkill for this — a simple check that the number starts with + (per OSM's phone tagging guidance) covers the common case of missing country codes.

  • Adds hasValidPhone(), checked alongside the existing hasMinimumData() before a note can be submitted
  • Reuses the existing (previously unused) validation.missingPhoneOrWebsite translation key, already present in every locale, to show the error
  • Resets the alert back to its default text/state when the form is cleared after a successful submission, so a leftover phone error message doesn't persist into the next note

Test plan

  • Verified the regex against valid (+1 555-555-5555, +420 123 456 789) and invalid (555-555-5555, +, abc) inputs
  • Confirmed the phone field remains optional — empty values still pass validation
  • Verified edited JS parses without syntax errors

@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for onosmorg ready!

Name Link
🔨 Latest commit e8e3424
🔍 Latest deploy log https://app.netlify.com/projects/onosmorg/deploys/6a543f637ac68300087e7367
😎 Deploy Preview https://deploy-preview-160--onosmorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@iandees iandees mentioned this pull request Jul 13, 2026
3 tasks
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.

Ensure country code is added to phone number

1 participant