Project

General

Profile

Actions

Bug #70916

closed

Flexform input range slider validation problem

Added by Alexander Götz about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-10-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello,

i'm on the latest TYPO3 7 dev-master.

My Flexform:

...
<settings.itemsPerPage>
    <TCEforms>
        <label>Test</label>
        <config>
            <type>input</type>
            <size>2</size>
            <default>10</default>
            <eval>int</eval>
            <range>
                <lower>1</lower>
                <upper>20</upper>
            </range>
            <wizards>
                <slider>
                    <type>slider</type>
                    <step>1</step>
                </slider>
            </wizards>
        </config>
    </TCEforms>
</settings.itemsPerPage>
...

If I choose a value through the slider or Input field the validation results (red marked input field) are:
1-2: no error
3-9: error
10-20: no error

I could solve the problem for my case if I changed the file:
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js (Line 290)

var minValue = rule.config.lower || 0;
var maxValue = rule.config.upper || Number.MAX_VALUE;

I casted the rule.config.lower and rule.config.upper to Int and the validation works alright.

I guess this would cause errors on other backend inputs but maybe there is a better solution for that.

Thanks.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #70923: TCA: Show proper error message if validation is failingAccepted2015-10-21

Actions
Actions #1

Updated by Simon Schaufelberger about 9 years ago

I just stumbled over exactly the same problem and spend hours looking for the problem. Glad that i found it!

TEST:

<script>
    var value = "3";
    var minValue = "1";
    var maxValue = "10";

    if (value < minValue || value > maxValue) {
        document.write('Error');
    }
</script>

Even though 3 is between 1 and 10, the error is shown.

Unfortunately it is not possible to tell in the xml that I am using integer here, or?

This is a solution for me:

minValue = parseInt(rule.config.lower) || 0;
maxValue = parseInt(rule.config.upper) || Number.MAX_VALUE;
value = parseInt(value);

I know that this doesn't work for floats. Maybe someone has a better idea?

PS: it is not related to the slider wizard. Even if disabled it does't validate.

Actions #2

Updated by Georg Ringer over 8 years ago

  • Status changed from New to Needs Feedback

can you please test latest master, I can not reproduce it there. thx

Actions #3

Updated by Alexander Götz over 8 years ago

I tested 7.6.9. It seems that the bug is fixed there. Thank you.

Actions #4

Updated by Riccardo De Contardi over 8 years ago

  • Status changed from Needs Feedback to Closed

I'll close it, thank you for your feedback and findings. Feel free to reopen if necessary

Actions

Also available in: Atom PDF