- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2016 02:39 PM
Hi, How would I validate a URL field on my request item form based on following criteria:
It should be entered by user in form of:
jb**.systemaudit.com
Basically it should stop user for submitting the request, so an onsubmit script, Any script suggestions?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 07:24 AM
Here you, these are the 2 versions I have got for you
1) It takes any two characters(this include digits)
function onSubmit() {
if(!(/jb.{2}.systemaudit.com/g.test(g_form.getValue("your field name goes here")))){
alert("please enter in desired format");
return false;
}
2)It takes only 2 digits
function onSubmit() {
if(!(/jb(\d){2}.systemaudit.com/g.test(g_form.getValue("your field name goes here")))){
alert("please enter in desired format");
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 01:46 AM
The following will take jb followed by two digits only. It also escapes the dots which are special.
function onSubmit() {
if(!(/jb[0-9][0-9]\.systemaudit\.com/g.test(g_form.getValue("your field name goes here")))){
alert("please enter in desired format");
return false;
}
If you need to make adjustments to the regular expression pattern, there are lots of online references and tutorials to help de-mystify:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 07:24 AM
Here you, these are the 2 versions I have got for you
1) It takes any two characters(this include digits)
function onSubmit() {
if(!(/jb.{2}.systemaudit.com/g.test(g_form.getValue("your field name goes here")))){
alert("please enter in desired format");
return false;
}
2)It takes only 2 digits
function onSubmit() {
if(!(/jb(\d){2}.systemaudit.com/g.test(g_form.getValue("your field name goes here")))){
alert("please enter in desired format");
return false;
}