Closed (won't fix)
Project:
Content Construction Kit (CCK)
Version:
5.x-1.3
Component:
number.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2007 at 16:50 UTC
Updated:
6 Aug 2014 at 18:28 UTC
Jump to comment: Most recent
Comments
Comment #1
yched commentedYes, actually the parsing of number fields remove any non numeric char (plus '-' and '.'). see http://drupal.org/node/108302
So if you enter 'azerty', you end up with '' (empty string).
But there is still
I think this is OK - but has a buggy side effect for required fields :
If you leave the field blank, you get a (Form API generated) 'required field' error
If you use invalid input ('azerty'), the field is not considered empty, then gets truncated to '', which gets stored as 0 in the db. And the field has a value that you did not actually enter, and which might not even be valid wrt min / max or allowed values settings.
Comment #2
yched commentedforget the incomplete 'But there is still' sentence above. Wrong edit.
Comment #3
yched commentedhttp://www.drupal.org/node/116263 was marked duplicate.
Comment #4
nterbogt commentedThere has to be a better way than just storing '' or a 0 in this case though. The current implementation is really really bad from a user point of view, and basically throws away all confidence in the system if they type 'something', save and see '0' in the results.
What are the general thoughts on how the CCK crew are going to deal with this. Could we just write a number validation function (one probably exists in PEAR) to rewrite all input to a general number format '123456789' and check that at the validate stage.
I understand that maintaining a function to do such a conversion would be a nightmare to maintain for internationalisation and the like, but anything is better than what current exists.
Comment #5
yched commentedhttp://drupal.org/node/125754 (marked as a duplicate of this one) highlight another aspect of this :
- give you field the value 1000000, submit
- re-edit : widget gets pre-filled with 1e+06, which gets parsed as 106 on next submit.
Bumping the issue to critical. Having the values change in your back is not an option.
Comment #6
dopry commented@yched: do you know if this is still an issue? or was it resolved else where?
Comment #7
yched commented@dopry : nope, still an issue (most probably in D6 branch as well)
Comment #8
karens commentedThe D5 version is no longer being supported. Sorry.
Comment #9
galaxor commentedThis is still a problem in 6.x-2.9. At least, the thing where it silently changes text strings to zero. We noticed it when users were putting thousands-separators into their numbers, and the numbers would be saved as zero.
Comment #10
galaxor commentedNever mind, it was a patch I put into my code for a different purpose that messed up validation.