range setup for number data input element in application develeopment

How to setup a data input element as number data range ? Example Obtain Marks should be 0 to 100 i.e. minimum 0 (Zero) and maximum 100

@frederikdc could you please help with this question :slightly_smiling_face:

We don’t have this functionality out of the box. There are 3 potential work arounds

The first one is to create new table and add the number 0 to 100. In your application, you can use a Record Selector and set the data source to that new table. When filling in the form, you can select a value from a dropdown list. The drawback of the approach if that you need to store the result in a Link to table field and use a formula to get the actual value

The second one is working with custom code. Set a class name like format_number in the style tab of the data input element. Open the custom code panel and add the following code

const input = document.querySelector('.format_number input')
input.setAttribute("type","number")
input.setAttribute("min",0)
input.setAttribute("max",100)

The drawback of this approach is that you can still type a higher number and store it in your database.

The last approach is using an automation to validate your input. If the record is added / updated and the number is higher than 100, you can set it to 100.

1 Like