- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 09:49 AM
In our incident form I need to set a field to only allow a numeric value in the format: xxxx.xx ...how?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 09:58 AM
Hello Becky,
You can create an OnChange client script on the field with script as. Please adjust field column name accordingly. In the ex below replace short_description with the exact column name.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var myVal = g_form.getValue('short_description');
var matchPattern = /^\d{4}[.]\d{2}$/;
var myResult = matchPattern.test(myVal);
if(!myResult){
g_form.clearValue('short_description');
g_form.showFieldMsg('short_description','Required format is xxxx.xx','error');
}
//Type appropriate comment here, and begin script below
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 09:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 09:58 AM
Hello Becky,
You can create an OnChange client script on the field with script as. Please adjust field column name accordingly. In the ex below replace short_description with the exact column name.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var myVal = g_form.getValue('short_description');
var matchPattern = /^\d{4}[.]\d{2}$/;
var myResult = matchPattern.test(myVal);
if(!myResult){
g_form.clearValue('short_description');
g_form.showFieldMsg('short_description','Required format is xxxx.xx','error');
}
//Type appropriate comment here, and begin script below
}