- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2024 05:58 AM
Hi All,
I have created record producer mapping custom table fields. I have some integer fields in custom table. But, in Record producer variable type there is no integer option. Since, i selected single line text.
Can someone help me how to set integer validation for multiple variables at a time.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2024 07:18 PM
You can modify the code something like below:
function onSubmit() {
var variableNames = ['variable_name1', 'variable_name2', 'variable_name3'];
for (var i = 0; i < variableNames.length; i++) {
var inputValue = g_form.getValue(variableNames[i]);
var intValue = parseInt(inputValue);
if (isNaN(intValue)) {
alert('Please enter a valid integer value for ' + variableNames[i] + '.');
return false; // Prevent submission
}
}
// Proceed with submission
return true;
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2024 09:22 AM
Hi @VikramM1 ,
You can select number field (or) create below validations on single text field:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var pattern=/[^\d]/g;
var b=pattern.test(newValue);
if(b=='true')
{
g_form.hideFieldMsg('numeric'); //name of the field you are using
g_form.addErrorMessage('numeric',"Please Enter numerical value only","error");
g_form.setValue('numeric','');
}
}