- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-03-2022 07:46 PM
Hi All, I have a integer field type . In that I need to restrict user to enter only few values like , 10,30,40. If the user try to enter any other values it should throw error .. any one help me with these work around here . Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-03-2022 10:27 PM
Hi,
Just add one more line as shown below:
g_form.showFieldMsg('field_name','Error Message: The entered value is not allowed','error');
g_form.clearValue('field_name');
// this will clear value , hope your field is mandatory so user won't be able to submit form with empty field
Or use same logic in on submit client script and instead of clear value use below:
g_form.showFieldMsg('field_name','Error Message: The entered value is not allowed','error');
return false;
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-06-2022 08:29 PM - edited ā10-06-2022 08:30 PM
Hi,
You can modify it like below:
if (g_form.getValue('field_name') != 10 && g_form.getValue('field_name') != 10 && g_form.getValue('field_name') != 30 && g_form.getValue('choice_field') == 1) {
g_form.showFieldMsg('field_name','Error Message: The entered value is not allowed','error');
g_from.clearValue('field_name');
}else if(g_form.getValue('field_name') != 40 && g_form.getValue('choice_field') == 2){
g_form.showFieldMsg('field_name','Error Message: The entered value is not allowed','error');
g_from.clearValue('field_name');
}
You can mark more than one answer as correct and helpful.
Thanks
Anil Lande