Editor - Use commas in number field for 1000's separator

Editor - Use commas in number field for 1000's separator

dpanscikdpanscik Posts: 202Questions: 47Answers: 0

In using editor to submit a record. Today I noticed the following number is allowed 333444.55 but the same number with a comma used as a 1000s separator is not allowed 333,444.55 When a comma is used as the 1000's separator, editor throws an error that says "Error converting data type nvarchar to float".

I do lots of form manipulation before the form gets to editor so I can grab the number at the form level and remove commas before sending the form on to editor.

But I thought I would check in to see if there is a easier way to allow commas in a number field. Something that is already incorporated into editor.

I paraded around the forum and the manual and didn't see anything obvious.

Answers

  • allanallan Posts: 63,483Questions: 1Answers: 10,467 Site admin

    Have a look at the masked input plugin. The problem with allowing formatted numbers is that it is very easy for the end user to submit something like "10,00.0" - it is an added mental question for them to thinking about if their input is correct. And if they don't think about it, it inevitably goes wrong! The masking plugin is a way to handle this. The other option is to use a formatter (either when reading the field's value, or at the server side when writing it) to try and strip the user's formatting.

    Allan

Sign In or Register to comment.