Validate phone and email for Organization#2112
Conversation
organizations/client/form/form.html
Outdated
| {{> afQuickField name='url' }} | ||
| {{> afQuickField name='description' }} | ||
| <span itemprop="name"> {{> afQuickField name='name' }} </span> | ||
| <span itemprop="url"> {{> afQuickField name='url' }}</span> |
There was a problem hiding this comment.
Use consistent indentation.
organizations/client/form/form.html
Outdated
| {{> afQuickField name='name' }} | ||
| {{> afQuickField name='url' }} | ||
| {{> afQuickField name='description' }} | ||
| <span itemprop="name"> {{> afQuickField name='name' }} </span> |
There was a problem hiding this comment.
To improve readability, nest HTML tags like so:
<span itemprop="name">
{{> afQuickField name='name' }}
</span>|
Requested small improvements for readability. |
organizations/collection/schema.js
Outdated
| type: String, | ||
| // can start with +/# ( 2 digits with or without ()) , can have -/./slash/or space between nos | ||
| //eg. +(XX)-XXXX-XXXX , +XX XXXX XXXXX , #X/XXXX/XXXX/XXXX , XX.XXXX.XXXX , XXXXXXXXXXXXX | ||
| regEx: /^\+|#?(|[(][0-9]{2})|[)]\)?[-|.|/|\s ]?([0-9]{4})[-|.|/|\s ]?([0-9]{4})$/, |
There was a problem hiding this comment.
I am wondering if this RegEx is too complicated.
|
@brylie : I made the RegEx changes as discussed with Taija. These include having + ,( ) , space , + , . ,/ while entering the phone. Right now # and * are not included. Please have a review and let me know the changes. |
organizations/collection/schema.js
Outdated
| type: String, | ||
| // can start with +/# ( 2 digits with or without ()) , can have -/./slash/or space between | ||
| // nos eg. +(XX)-XXXX-XXXX , +XX XXXX XXXXX , XX.XXXX.XXXX , XXXXXXXXXXXXX | ||
| regEx: /^\+?(|[(][0-9]{2})|[)]\)?[-|.|/|\s ]?([0-9]{4})[-|.|/|\s ]?([0-9]{4})$/, |
There was a problem hiding this comment.
Hi Sri,
Just wanted to make sure you understood my earlier comment. I would like you to control only which characters are allowed in the field, but not their order or grouping. But this is really hard for me to read, so I'm not sure what you are doing.
The reason why we do not want to control e.g. grouping is that the grouping of phone numbers depends on the locale (in this case country, not so much language). So just keep it simple.
There was a problem hiding this comment.
@bajiat : Hi Taija : Ok , will rework on the expression again.
organizations/collection/schema.js
Outdated
| // can start with +/# ( 2 digits with or without ()) , can have -/./slash/or space between | ||
| // nos eg. +(XX)-XXXX-XXXX , +XX XXXX XXXXX , XX.XXXX.XXXX , XXXXXXXXXXXXX | ||
| regEx: /^\+?(|[(][0-9]{2})|[)]\)?[-|.|/|\s ]?([0-9]{4})[-|.|/|\s ]?([0-9]{4})$/, | ||
| regEx: /^[0-9-+()/\s]+$/, |
There was a problem hiding this comment.
Remember to add a comment describing why this regular expression is written this way. What characters are you intending to allow?
organizations/collection/schema.js
Outdated
| type: String, | ||
| // all numbers (0-9) , + , - , space ,/ are allowed and can appear anywhere in the phone numbers | ||
| //e.g. 754-3010,(541) 754-3010,1-541-754-3010,1-541-754-3010,191 541 754 3010,(089) / 636-48018 | ||
| regEx: /^[0-9-+()/\s]+$/, |
There was a problem hiding this comment.
Remember to allow dot character '.'
Added semantic tags for organization from schema.org.
Validated email and phone number using regular expression while adding/updating organization.
Regular Expression Explanation for phone no:
Issue 'Email' and 'phone' fields not validated in 'Add Organization' form #2034