Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Pedro Barbosa
52
Views
3
Comments
Javascript Validation on "Phone Number" type!
Question
Ok guys, this is my first post and i will try to explain as best as i can....
Development Scenario:
1 entity with 4 atributes
Entity: Person
Person's Attributes
Id ( obviously )
Name ( type: text )
Age ( type: integer )
Phone Number ( type: phone number )
I have developed a form (3 input widgets) to insert a new Person.
the Name input widget is assigned to a Text type variable.
the Age input widget is assigned to an Integer type variable.
the Phone number input widget is assigned to a Phone Number type variable.
I am able to use the validation for the Age field properly. When someone tries to fill the Age field with non-numeric characters, the system returns the default message "Integer Expected!".
So far so good.
But now i want to do the same thing for the Phone Number and i did exactly the same. I just assign the input widget to get its input variable into a variable of type "Phone Number" and it still allows non-numeric characters and no message pops up.
if i look at the sourcecode, the validator for "Phone Number" is there, but it doesn't work!
I know that this works for phone number as well because i have seen on the Help of Service Studio and on the default messages i see "Phone Number Expected!" as well...
Can anyone help me?
Tiago Simões
Staff
Hi Pedro,
First of all let me welcome you to the community and thank you very much your effort to be clear.
Let me to try to be it as well. The "Phone Number" type is actually an alias to the "Text" data type.
This is because international phone numbers often have the "+" sign.
If you want to assure that only numeric chars are entered you can:
Use the
TextToIntegerValidate()
function and an
If tool
in a
Screen Action
.
A simpler option would be to use the
Integer
data type on that attribute.
I hope this helps, but let us know if you need any more help.
Cheers,
Tiago Simoes
1 reply
06 Jun 2006
Show thread
Hide thread
Pedro Barbosa
Thanks for the reply Tiago.
I just tried those methods that you indicated and they prevent me of using the '+' and space characters and i want to allow numbers, '+' and space...
i don't want to use custom javascript functions made by myself because some of the fields are already using the outsystems validation and i can't change that... (i am resuming someone else's work)
i must use the same outsystems validation for the "Phone Number" field!
Tiago Simões
Staff
...or you could use the
Extension Text
that has a
Regex_Search
action.
This would give you more versatility. See the attached oml for an example.
Cheers,
Tiago
ValidatePhoneNumber.oml
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...