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.

Currently rated 5.0 by 3 people

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