SenseNet / sensenet

Open Source Content Services Platform written in .NET
https://sensenet.com
GNU General Public License v2.0
174 stars 111 forks source link

The number fields cannot be editing #2105

Open kavics opened 1 month ago

kavics commented 1 month ago

Reproduction:

  1. Create a number field in an appropriate CTD
    <Field name="NumberField" type="Number">
      <DisplayName>NumberField</DisplayName>
      <Description></Description>
      <Configuration>
        <Digits>4</Digits>
      </Configuration>
    </Field>
  2. Create or modify a content from the selected CTD
  3. Write the number control: 3.1415
  4. Submit
  5. Red error bar appeared: "Input string was not in a correct format."

The ',' (colon) cannot be written as the decimal point maybe it is a forbidden key but my culture is HU-hu.

Maybe this pseudo code can work:

let number;
if(Number.TryParse(textBox1.text, out number))
    return number;
if(Number.TryParse(textBox1.text, CultureInfo.InvariantCulture, out number))
    return number;
throw ("Cannot parse...")