The CreatorCon Call for Content is officially open! Get started here.

Regex Field Validation on Catalog Item does not prevent submission

GaryJHayes
Tera Guru

I have defined a Variable Validation Regex for a simple 6 digit number on my Madrid system:

find_real_file.png

This expression works fine and generates the field error:

find_real_file.png

However, when I hit the submit button the record is submitted without an error.

Other posts on this forum suggest that the submission should be prevented with an error

Is there anything else I need to do?

1 ACCEPTED SOLUTION

Hi there,

Yes it should prevent the submission. Tested this on Madrid + New York.

Are you using default SC Catalog Item widget? Catalog Item? Record Producer? Are you on Madrid or other version?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

7 REPLIES 7

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


I assume you use Client script and your are not stopping the form submission.


Use return false.


Thanks,
Ashutosh

Sanket Khabiya
Kilo Sage

Hi GaryJHayes,

 

Better go for client Script:

 

Type : On change 

Field : <Select_variable>          //Employee Number 

Script : 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

 

var empid= /^[0-9]{6}$/;

if (!empid.test(newValue) && newValue!="") {

g_form.setValue('<variable_name>','');      //Employee Number

g_form.showFieldMsg("<Variable_name>","Not a Valid Employee number","error");

}

 )

 

Regards,

Sanket

Sanket Khabiya
Kilo Sage

Below Article may help you!!

I found an Article which says that it will Prevent the form Submission.

https://community.servicenow.com/community?id=community_article&sys_id=e334bc4cdbe0bf48fff8a345ca961...

 

Regards,

Sanket