Solved

How to ensure parameter input is valid mobile number?

  • 26 November 2022
  • 3 replies
  • 34 views

Badge +7

Hi,

I have a parameter in my workbench that I want to lock down to expect a 10 digit phone number.

 

Here in Australia they all start with 04, so I am hoping to make my parameter restricted to between 0400000000 and 0499999999. It doesn't work if I use integer, because it drops the leading zero.

 

Does anyone have any tips on how I can achieve this? Ultimately this will be published to server and be a web form input field. I am hoping the user cannot press submit until the mobile number is in the range I mention above.

 

Cheers

icon

Best answer by egge 27 November 2022, 15:07

View original

3 replies

Userlevel 1
Badge +11

Hi,

Within a workspace you can test your phone numbers using a regular expression. In your case the magic formula would be something like ^04\\d{8}$ (see screenshot below)

But now the question is: can you use this regular expression to test the input for the User Parameter in your web form to not allow any invalid input? This question has already been asked earlier this year, see this discussion: Regex check during input of text in user parameter.

Unfortunately, the answer, my friend, is: NO... :-(

But you can vote for this Idea: AC Idea: Regex check for text User Parameter

 

regexHTH,

 

Egge-Jan

Badge +7

Hi,

Within a workspace you can test your phone numbers using a regular expression. In your case the magic formula would be something like ^04\\d{8}$ (see screenshot below)

But now the question is: can you use this regular expression to test the input for the User Parameter in your web form to not allow any invalid input? This question has already been asked earlier this year, see this discussion: Regex check during input of text in user parameter.

Unfortunately, the answer, my friend, is: NO... :-(

But you can vote for this Idea: AC Idea: Regex check for text User Parameter

 

regexHTH,

 

Egge-Jan

Thanks for taking the time to reply. I have upvoted that idea, its exactly what is required in my situation. Kind regards.

Userlevel 5
Badge +29

Hi,

Within a workspace you can test your phone numbers using a regular expression. In your case the magic formula would be something like ^04\\d{8}$ (see screenshot below)

But now the question is: can you use this regular expression to test the input for the User Parameter in your web form to not allow any invalid input? This question has already been asked earlier this year, see this discussion: Regex check during input of text in user parameter.

Unfortunately, the answer, my friend, is: NO... :-(

But you can vote for this Idea: AC Idea: Regex check for text User Parameter

 

regexHTH,

 

Egge-Jan

A way i've "worked" around this limitation is making the first thing that the workspace does is validating those requirements

Reply