Validations on variable text field - Allow only Numbers and Special Characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2021 06:35 AM
Hi All,
I want a validation in my variable - only numbers and special characters should be allowed
Below code did not work. Can someone please help with the code for all the validations.
var pattern = /^[_A-z]*((-|\s)*[_A-z])*$/;
var name = g_form.getValue('number');
if (!pattern.test(number)){
g_form.addErrorMessage("Only Numbers and Characters are allowed");
}
}
Thanks,
Karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2021 10:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2021 03:32 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 04:07 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Thanks!
Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2022 02:06 AM
Hi
Greetings !!!
The requirement that I have is to allow space as well as plus(+) character in addition to numbers and other special characters. Could you please guide me how can I modify following Regex to fulfil my requirement ?
Regex: ^(?=.*?[1-9])[0-9()-]+$
Would appreciate your help in this matter.
Thanks & Regards,
Gulzar Manuja