what is the code of only accept numerics only 10 digits
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:22 PM
what is the code of only accept numerics only 10 digits
if end user tries to enter the alphabets it show one message it accepts only numerics
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 10:28 PM
Please check if this helps.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var str = g_form.getValue('your_field');
var patt = /\d{10}/;
var result = patt.test(str);
if (!result) {
g_form.setValue('your_field', '')';
alert('Please enter value 10 digit number');
}
}