Skip to content

Conversation

@megoth
Copy link
Contributor

@megoth megoth commented May 31, 2019

The regex for phones is still not great, but we'll leave it at this for now until we have a more thorough change of the profile pane

@megoth megoth requested a review from Vinnl May 31, 2019 06:30
@megoth megoth force-pushed the fix/no-space-in-phone branch from cd7ef18 to 8b1ccce Compare May 31, 2019 06:47
UI.widgets.fieldParams[UI.ns.ui('PhoneField').uri] = { 'size': 20, 'uriPrefix': 'tel:' }
UI.widgets.fieldParams[UI.ns.ui('PhoneField').uri].pattern =
/^\s*\+?[ 0-9-]+[0-9]\s*$/
/^\s*\+?[0-9-]+[0-9]\s*$/
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we also disallow whitespace on either side of the phone number?

Copy link
Contributor

Choose a reason for hiding this comment

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

While we're at it, shall we just \d?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do - wanted to keep the changes minimal, as to not introduce any errors (I'm not very good with regex, after all). But I've tried a slight change now, hopefully to the better.

@Vinnl
Copy link
Contributor

Vinnl commented Jun 3, 2019

I'm fine with merging, so go ahead if you want - just not sure if whitespace at the start or end of a phone number won't cause problems either :)

@megoth megoth force-pushed the fix/no-space-in-phone branch from 8b1ccce to 1be10f3 Compare June 3, 2019 12:57
@megoth
Copy link
Contributor Author

megoth commented Jun 3, 2019

I'm fine with merging, so go ahead if you want - just not sure if whitespace at the start or end of a phone number won't cause problems either :)

Tried to improve the regex used - please double-check, then we'll start publishing updates to NPM.

@megoth megoth changed the title This little space-bugger should not be here Fixing bug in regex for phone field Jun 3, 2019
@Vinnl Vinnl merged commit 462d566 into master Jun 3, 2019
@megoth megoth deleted the fix/no-space-in-phone branch August 12, 2019 15:23
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.

4 participants