I am trying to submit a form that contains localized data and numeric textboxes with decimal numbers.
The culture I use is hr-HR and decimal data numbers look like 123,45. the problem is that whenever the decimals are present, the form will not submit. I think it might be the validation because of the (,) instead of the dot, If I leave zeroes in decimal places, the form submits nicely.
How do I get the form to accept localized decimal numbers?
I've realized that the NumericTextbox doesnt see comma (which are created on GET) as the decimal separator. And due to change culture I cannot use dots. So Im cornered.
Is this a bug or am I missing something?
7 Answers, 1 is accepted
I face the same problem. Did You ever find a solution?
This happens because when a form is submitted the browser is sending the input elements values. In this scenario however, there is a difference between the input value and the actual Widget value. I would recommend you to attach a handler to the form's submit event and assign proper values to the numeric input elements. For convenience I created this small example demonstrating such behavior.
Thank you for your answer and example.
But I believe that the problem I am facing might have a different explanation.
This is my scenario:
On a HTML page I have a form with two numeric txtboxes using format N2, validation enabled and the culture set to "da-DK".
Culture "da-DK" uses "," as decimal separator and "." as thousand separator.
When entering values the numerictextbox accepts the decimal separator but the validation fails.
When changing culture to "en-US" the validation is successful.
I have stripped down my code to this example that illustrates this behaviour.
The numerictextbox elements are as rendered by the Kendo UI libraries.
If I omit the form element the validation error message is not shown. Doesn't validation occur when there is no form element?
Do you have any clue to what causes this? Is it a bug in Kendo or in my code?
Kristian Vad Nielsen
You will notice, in the example above, that I use culture "de-DE" instead of "da-DK" since the culture script "kendo.culture.da-DK.js" apparently
doesn't exist alongside the other culture scripts. I doesn't make much difference in this example since they both use same decimal separator.
Kristian Vad Nielsen
This happens because jQuery Unobtrusive Validation does not support globalization out of the box. Although you've set the client-side culture using Kendo and configured the widgets to properly work with a comma as a decimal separator, jQuery validation still tries to validate the numbers using a period as a separator. For more information on how to globalize jQuery validation I would recommend you to check the following blog post:
I have the same issue related to server-side validation of decimal numbers with comma separator.
However, the provided link isn't working anymore.
Can you please help me ?
Thanks and regards.
You can take a look at the following help article and forum thread: