U4-366 - CMS Input validation problem on numbers

Created by Sebastiaan Janssen 19 Aug 2012, 14:51:31 Updated by Sebastiaan Janssen 05 Jun 2015, 16:28:23

Relates to: U4-902

Relates to: U4-1314

Subtask of: U4-760

I have a Numeric field within a page. When a non integer is added no errors are created but the field comes back empty. This is a problem as the user thinks everything is ok. We noticed this problem when adding commas to numbers, i.e.

19000 > 19,000

I have tried adding regular expression validation to ensure it is a number. However it is seems that the validation is done after the attempt to convert to an number which is wiping the data so the validation is performed on an empty field. This latter bit is my theory on how it is working.

I am using umbraco v 4.5.2 (Assembly version: 1.0.3891.20719) with mySQL

''Originally created on CodePlex by [billyhomebase|http://www.codeplex.com/site/users/view/billyhomebase]'' on 2/14/2011 3:44:55 PM [Codeplex ID: 30034 - Codeplex Votes: 4]

Imported comments

''Comment by [barnakles|http://www.codeplex.com/site/users/view/barnakles] on 9/14/2011 2:46:25 AM:'' Also happening on 4.7 (numeric datatype)

1 Attachments

Download U4-366-AllowThousands.patch

Comments

Hendy Racher 25 Oct 2012, 09:42:07

regular expression now fires, but the datatype won't allow saving of anything other than an integer (this is to prevent saving invalid values in a int db field) - Would it make sense to remove the option specifying the database datatype, defaulting it to use 'int' - backwards compatibility for setups that have used txt fields ?


Sebastiaan Janssen 31 Oct 2012, 10:23:28

@Hendy can you make it so that either gives a validation error when saving please? Right now it doesn't save anything if the value if not an int which is not what you'd expect.


Jeavon Leopold 08 Nov 2012, 09:39:08

Patch attached to allow commas to be entered for Thousands. To display a validation message is going to require a pretty significant rebuild of the property editor and I therefore think it should be a separate issue. It is also going to be a similar challenge to that described in U4-854.


Sebastiaan Janssen 08 Nov 2012, 12:42:27

Perfect! Thanks Jeavon!


Sebastiaan Janssen 08 Nov 2012, 12:43:30

Fixed in changeset fa1b18236d0f


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Patch

Affected versions:

Due in version: 4.10.0

Sprint:

Story Points:

Cycle: