[FORM] Numeric input accepting german decimal

Hello,

I have a form with an input element for numeric values, ie. validation property is set to “numeric”.

How can I allow german comma instead of point for the decimal separator so for example the value “1,23” does not throw an error and is interpreted as “1.23”?

Thanks in advance.

Best,
benny

Unfortunately the “numeric” calidation uses common js format of numbers. In case of the specific locales I can suggest you to create a custom validation ruleusing your own function:
https://docs.dhtmlx.com/suite/form__work_with_form.html#validatingform

1 Like

use react-international-number-input - npm
it is really very helpful
it adapts input format according to location automatically

you don’t need to do extra thing

import React, { useState } from ‘react’;
import InternationalNumberInput from ‘react-international-number-input’;

const App = () => {
const [value, setValue] = useState(0);

return (


International Number Input


<InternationalNumberInput
value={value}
handleChange={(newValue) => setValue(newValue || 0)}
placeholder=“Enter amount”
className=“number-input”
style={{ width: ‘200px’, padding: ‘5px’ }}
disabled={false}
prefix=“$”
suffix=“%”
/>

);
};