# Phone Number validation

**URL:** <https://meta.discourse.org/t/phone-number-validation/182761>\
**Category:** Product Support\
**Created:** [March 10, 2021, 3:03pm UTC](https://meta.discourse.org/t/phone-number-validation/182761 "2021-03-10T15:03:53Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![PBS](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pbs/32/209265_2.png) [@PBS](https://meta.discourse.org/u/PBS)\
**Post date:** [March 10, 2021, 3:03pm UTC](https://meta.discourse.org/t/phone-number-validation/182761/1 "2021-03-10T15:03:53Z")

</div>

Hello Support,

I am trying to validate the phone number which user enters during registration. So I added few user fields to registration screen. So I make the user enter his phone number.  
I also have added code in the themes JS section, which can send a OTP to user.

I have not been able to figure out the best way to take the phone number from profile and send an sms to it.  
What I have tried:  
Use a wizard after registration. It will run automatically.

1. When it opens, I need the phone number of the profile. (I see that wizard can get default attributes like username u{username}, but not my custom field phonenumber u{phone})
2. When I get the number (which I can make the user enter in a field again), how to call my JS code which I entered in the theme JS section.  
I have seen that when a normal page is loaded, api.onPageChange((url) =\> {  
This works. But when wizard gets loaded, this does not work.  
I tried using the document model,

if (‘Discourse’ in window) {  
if (‘Discourse’ in window && typeof Discourse.\_registerPluginCode === ‘function’) {  
Discourse.\_registerPluginCode  
But register plugin fails.

So I am not sure, if I am on the right track or if there might be a simple way of taking the phone number and executing a custom JS code for sending sms.

Thanks,  
Prashanth

---

_[View the full topic](https://meta.discourse.org/t/phone-number-validation/182761)._
