This is a migrated thread and some comments may be shown as answers.

Locale agnostic numeric validation in grid

1 Answer 244 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Jane
Top achievements
Rank 1
Jane asked on 25 Jan 2017, 06:27 AM

Hi,

I'm using Kendo UI for JSP and I have the following definition in my database schema model for a grid:

<kendo:dataSource-schema-model-field name="density" type="string" >
         <kendo:dataSource-schema-model-field-validation required="true" min="0" pattern="\d{0,8}(\.\d{1,4})?" />
</kendo:dataSource-schema-model-field>

 

Obviously this is only going to work if a . (full stop) is used as the decimal point.  However, my application is going to be deployed in multiple countries so I need a locale agnostic solution.

In plain html5 I can have an input type="number" and use the step attribute to control the number of decimal places.  However, if I use type="number" in a grid then Kendo UI renders it as a NumericTextBox and I can't see how to set the number of decimal places.  (It defaults to 2 and I need 4). 

I don't want my input field to be rendered as a NumericTextBox but I want to be able to validate it as a valid numeric whatever the locale.  Could you please tell me how to achieve this?   

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 27 Jan 2017, 06:13 AM

Hello Jane,

In your case, I would rather suggest using the number type and customize the editor of the field. You can see how here: http://demos.telerik.com/jsp-ui/grid/editing-custom. That will enable you to further configure the NumericTextBox with the decimals option and optionally, culture option.

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Validation
Asked by
Jane
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or