Loading ...

Handling Minimum and Maximum Values for Decimal Fields in Grids and Forms in Acumatica

When setting a minimum and maximum value for decimal fields in your Data Access Class (DAC) in Acumatica, you might notice that the validation works in forms but not in grids. This happens because grid controls don’t automatically apply the min/max range validation unless you explicitly define the fields as NumberEdit elements in your grid’s row template.

Problem Overview

Consider the following DAC configuration for a decimal field:


While this setup works for form fields (i.e., Acumatica will enforce minimum and maximum values in forms), grids don’t respect these range constraints. To make it work in grids, we need to adjust the grid’s row template and use the NumberEdit control. As you can see in the screenshot below we can input a number bigger than what we set as the MaxValue property (which is 100):

 

 

 

 

 

Solution: Using NumberEdit for Grids


To enforce min/max validation in grids, you need to specify a row template in your ASPX file that uses NumberEdit for the decimal field.

 



After saving the changes you will notice that a new element called Field Editor has been added to your grid column as in the screenshot below:



 

This also generates an appropriate ASPX code for your grid like this:



 


Conclusion

When working with decimal fields in Acumatica, if you need consistent validation of minimum and maximum values across grids and forms, the key is to use the NumberEdit element in the grid’s row template. While forms handle this validation natively, grids require this additional customization to ensure proper validation of user input.

By following this approach, you ensure that users cannot enter values outside the specified range in both grids and forms, improving data integrity and user experience.

Need Customization for Acumatica?

If you're looking to enhance your Acumatica instance with specific customizations like the one outlined in this article, don’t hesitate to reach out! Our team specializes in Acumatica development and can help you implement tailored solutions that ensure smooth functionality across both grids and forms. Leave a request for your customization today, and let's take your Acumatica experience to the next level!

Currently rated 5.0 by 3 people

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5