sitegeist / Sitegeist.PaperTiger

Form builder for Neos CMS based on Neos.Fusion.Form
GNU General Public License v3.0
0 stars 3 forks source link

Number minvalue = 0 evaluates as false and therfore not considered #31

Closed TheCrealm closed 7 months ago

TheCrealm commented 7 months ago

The min/max properties of numbers are not considered when their value is 0 as it evaluates as false. Probably does not make sense as max value but for min it helps to not accept negative numbers.

In NodeTypes/Field/Text/SingleLine/SingleLine.fusion there is

attributes.min={props.minimumValue ? props.minimumValue : false}
attributes.max={props.minimumValue ? props.maximumValue : false}

The following fix works for me:

attributes.min={Type.isNumeric(props.minimumValue) ? props.minimumValue : false}
attributes.max={Type.isNumeric(props.maximumValue) ? props.maximumValue : false}

Besides that, attributes.max uses the min value for the null check.