Bug #70916
closedFlexform input range slider validation problem
0%
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.
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.
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
Updated by Alexander Götz over 8 years ago
I tested 7.6.9. It seems that the bug is fixed there. Thank you.
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