简体   繁体   中英

How to add number validation in Neos form?

I have to validate a textbox in Neos form. I want to validate a number between 7 to 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: ''

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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