- 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-06-2016 02:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2016 02:41 PM
Hi,
You could do this with a regular expression. I take it that ** represents any two characters, so jb01.systemaudit.com jbZZ.systemaudit.com and jb-$.systemaudit.com are all valid values, correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2016 02:45 PM
Use this
function onSubmit() {
if(!(/jb.*.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-06-2016 09:38 PM
It works great. One question though, it also works for jb87systemaudit.com, basically it should not accept this.
jb87.systemaudit.com is correct that works.
How to make sure jb87systemaudit.com doesnt work?