Add a Phone number field. It should accept 10 digits (numeric) and can't be left alone.

gouthamsainallu
Tera Expert

Hii

        Can you please tell me how can I do this.

1 ACCEPTED SOLUTION

Hii,


        Thank you for ur reply actually in incident I didnt find the variable field so can you please tell me how can i do...by providing any screenshots.


View solution in original post

8 REPLIES 8

snehabinani26
Tera Guru

Hi,



Here's a fairly lightweight script that we use onChange on variables pretty frequently. It allows for a few different phone number formats and uses a standard popup.





  1. function onChange(control, oldValue, newValue, isLoading) {  
  2.   if(isLoading || newValue == ''){  
  3.           return;  
  4.   }  
  5.   // Allows formats of (999) 999-9999, 999-999-9999, and 9999999999  
  6.   var pattern = /^[(]?(\d{3})[)]?[-|\s]?(\d{3})[-|\s]?(\d{4})$/;  
  7.   if(!pattern.test(newValue)){  
  8.           alert('Phone enter a valid phone number');  
  9.           g_form.setValue('variablename', '');  
  10.   }  
  11. }  

Hii,


        Thank you for ur reply actually in incident I didnt find the variable field so can you please tell me how can i do...by providing any screenshots.


Navigate to the table and then select the table where you want to add this field.



find_real_file.png


Hii,


        I didnt get it..I got that field bt in phone number options india is not available and how can see the output.If i enter any number i get alert.so can you please.