How do you limit a variable to 10digits?

Navneet3
Tera Expert

Hi, The requirement is> minimum of 10 digits is required for a variable.

Is this the correct script?

Here is the script. I created a on change script.

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


if (isLoading || newValue == '') {

return;

}

 var val = g_form.getValue('Facility_npi');

var pattern = /\d{10}/;

if (pattern.test(val))


alert('looks like 10 digits');


else

find_real_file.png

 

 

find_real_file.png

 

 

 

15 REPLIES 15

Sharad Patel
Tera Expert

Why script? Use Number validation regex and max_length variable attributes

 

find_real_file.png