Bug #17428

Eval => int will create '0' as value which is wrong

Added by Georg Ringer over 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2007-06-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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)

#1

Updated by Dmitry Dulepov over 13 years ago

You should use a checkbox like this:

<checkbox>1000</checkbox>

#2

Updated by Georg Ringer over 13 years ago

This still doesn'T solve the problem because the value is optional and so 1000 as default is not an option

#3

Updated by Dmitry Dulepov over 13 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'.

#4

Updated by Georg Ringer over 13 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

#5

Updated by Dmitry Dulepov over 13 years ago

You set evaluation to int. In PHP empty integer values evaluate to 0...

#6

Updated by Georg Ringer over 13 years ago

ok, so please close this or delete it and thx for explanation

#7

Updated by Martin Kutschker over 13 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)

Also available in: Atom PDF