Skip to main content
vikashk739
November 8, 2021
Question

How to add validation for phone number?

  • November 8, 2021
  • 1 reply
  • 0 views

I am getting a broken process if a user is entering phone number like 123 4567890. So I want to add a validation that when user enter any space between the phone number, the field should not accept the value and ask user to enter telephone number without any space

1 reply

richardm900458
November 8, 2021

Hi, there are two possibilites:
stripwith("text string"," ")
1.) you use the "validations" paramter of your textfield

https://docs.appian.com/suite/help/21.3/Text_Component.html

valdiations:	if(
    search(" ","textstring",1)>0,
    "Please enter online Numbers without space (' ')",
    {}
  )


2.) you clean up the user input in your saveInto: 

a!save(
    target: local!yourvariable,
    value: stripwith("text string"," ")
)

a!save(
    target: local!yourvariable,
    value: cleanwith("123 3123","123456789")
)