- 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-03-2022 09:36 PM
Hi Anil, yes. It's showing error msg now . But if i try to save it, it's taking values which not called on client script. Is there any changes needed to stop the data base(save)entry apart from value which we called in script ? Ex .If i enter 15 it should not allow me to save.. pls help me with

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 10:02 PM
Hi Vinay,
Could you please share for which all values you want to show the error messages?

- 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-03-2022 11:17 PM
Thanks Anil, working as expected. Thanks a ton
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:33 PM
Hi Anil, slight changes needed. There is one more choice field there, So if selection choice is 1, integer should only accept 10, 20,30 and if choice is 2 then only it should accept 40..pls help me to to achieve this request