field validation on a form - alpha numeric only
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago - last edited 7 hours ago
Hello all
I have a request to update an existing field on Incident form to a specific format as users are entering garbage data in the field now..
Entry should be restricted to alpha-numeric (for example: 123X)
What's the easiest way to accomplishing this?
thanks for your help
Labels:
- Labels:
-
Incident Management
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I suppose this depends on needs, but one way is through a Client Script (onChange for the respective field) where you do a regular expression evaluation like this:
var str = newValue;
str = str.replace(/[A-Za-z0-9]/g,"");
if (str != "") {
g_form.clearValue("<field>")
}
Sable Vimes - CSA
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Another example (maybe simpler)
var useRegEx = /[^A-Za-z0-9]/;
var str = newValue;
if (useRegEx.test(str)) {
g_form.clearValue("<field>");
}
Sable Vimes - CSA
