Bug #17428
closedEval => int will create '0' as value which is wrong
0%
Description
I got a field which holds a duration in ms but it should be at least 1000 (ms = 1s). To check the minimum, I use the range which works fine.
If I wanna check for integer too (eval => int) and I click into the field and leave it again or if I want to delete a value, I always get the value '0'. This is a bug because after saving there will be the value 1000 saved (cause of the range checked serverside).
So if the field is empty, just do nothing and if there is a value, check it for int
my configuration
<config>
<type>input</type>
<size>3</size>
<eval>int</eval>
<range>
<lower>1000</lower>
<upper>30000</upper>
</range>
</config>
(issue imported from #M5876)
Updated by Dmitry Dulepov over 17 years ago
You should use a checkbox like this:
<checkbox>1000</checkbox>
Updated by Georg Ringer over 17 years ago
This still doesn'T solve the problem because the value is optional and so 1000 as default is not an option
Updated by Dmitry Dulepov over 17 years ago
So, what do you want to have in the database if not 0 or 1000? How did you define field in SQL? By default it is NOT NULL DEFAULT '0'.
Updated by Georg Ringer over 17 years ago
It is just inside of flexforms and the best thing would be just nothing stored. Of course I could make 0 as default value and catch this inside my extension but the better way would be just nothing
Updated by Dmitry Dulepov over 17 years ago
You set evaluation to int. In PHP empty integer values evaluate to 0...
Updated by Georg Ringer over 17 years ago
ok, so please close this or delete it and thx for explanation
Updated by Martin Kutschker over 17 years ago
I'm closing it on request, but of course Georg is right, the behaviour is dull. The problem is that the TCA doesn't distinct between field type (eg string, integer), input value transformation (eg md5) and value validation (eg range)