How to validate a numeric range float field in Nuxeo Studio on a form layout?

Using purely Nuxeo Studio, how do you go about validating a numeric range for a float field in a form layout?

Currently, I have the validation set in the schema field properties that this float can only be values in the inclusive-range: [0.1, 9.9].

However, when the user goes to submit this form, they can still post the request but the form is not saved (as expected) & a 'Transaction Failed' notification is displayed in the upper-right corner of the screen.

How do I set this validation to occur in the form layout?

For example, if you set a field to be required in a form layout, it will not let the user submit the form and will show a 'Value is required' error message in the layout. How do I achieve this for a numeric range?

0 votes

1 answers

1411 views

ANSWER



Hello,

If you set your integer property as required with a numeric range, then Studio Designer will automatically generate the suitable UI element. For example, this is what it typically generates:

<nuxeo-input role="widget" value="{{document.properties.myschema:test}}" label="Test" type="number" min="3" max="7" required="true"></nuxeo-input>

So, you can still play with the attributes of our elements anyway.

1 votes