简体   繁体   English

如何以Neos形式添加数字验证?

[英]How to add number validation in Neos form?

I have to validate a textbox in Neos form. 我必须验证Neos形式的文本框。 I want to validate a number between 7 to 90. 我想验证7到90之间的数字。

Here is my code, but it is not working: 这是我的代码,但是不起作用:

 type: 'TYPO3.Form:SingleLineText'
    identifier: liednummer
    label: 'Die Nummer meines Lieblingsliedes'
    validators:
      - identifier: 'TYPO3.Flow:NotEmpty'
      - identifier: 'TYPO3.Flow:NumberRange'
    properties:
      placeholder: 'Liednummer'
      validation:
        'TYPO3\Flow\Validation\Validator\NumberRangeValidator':
          minimum: 7
          maximum: 90
    defaultValue: ''

What is wrong? 怎么了? Empty is working, but number and number range is not working. 空工作正常,但数字和数字范围无效。

Quite old question, so you have probably solved that problem, but maybe it will help someone else: 相当老的问题,所以您可能已经解决了这个问题,但是也许可以帮助其他人:

type: 'TYPO3.Form:SingleLineText'
identifier: liednummer
label: 'Die Nummer meines Lieblingsliedes'
validators:
  -
    identifier: 'TYPO3.Flow:NumberRange'
    options:
      minimum: '8'
      maximum: '22'
  -
    identifier: 'TYPO3.Flow:NotEmpty'
properties:
  placeholder: 10
defaultValue: ''

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM