This is a migrated thread and some comments may be shown as answers.
numeric textbox gives problem while trying to submit
7 Answers 103 Views
This is a migrated thread and some comments may be shown as answers.
Goran
Top achievements
Rank 1
Goran asked on 09 Oct 2012, 11:07 PM

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

Sort by
0
kvn
Top achievements
Rank 1
answered on 30 Sep 2013, 01:00 PM
Hi Goran,
I face the same problem. Did You ever find a solution?
/Kristian
0
Alexander Popov
Telerik team
answered on 02 Oct 2013, 01:53 PM
Hello Kristian,

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.
 

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
kvn
Top achievements
Rank 1
answered on 03 Oct 2013, 09:56 AM
Hello Alexander,

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?

Regards,
Kristian Vad Nielsen

0
kvn
Top achievements
Rank 1
answered on 03 Oct 2013, 10:04 AM
Hello Alexander,

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.

Regards,
Kristian Vad Nielsen
0
Alexander Popov
Telerik team
answered on 07 Oct 2013, 12:01 PM
Hello Kristian,

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:


Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Eva
Top achievements
Rank 1
answered on 22 May 2018, 12:49 PM

Hello,

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.

 

0
Konstantin Dikov
Telerik team
answered on 25 May 2018, 08:48 AM
Hello Eva,

You can take a look at the following help article and forum thread:

Best Regards,
Konstantin Dikov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Goran
Top achievements
Rank 1
Answers by
kvn
Top achievements
Rank 1
Alexander Popov
Telerik team
Eva
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or