svelte-formly icon indicating copy to clipboard operation
svelte-formly copied to clipboard

Max/min mixmatch between numbers and strings

Open Solaris9 opened this issue 3 years ago • 1 comments

Issue

Lets say you have a field for a username and set the min/max to 3 and 10, entering any A-Z character will work as expected but entering "11" as in the number 11 will say the input is too big for that field, it thinks you're entering a number literal instead of plain text so 11 >= 10 instead of (2 >= 11, the length of the input text). You handle both numbers and strings with the same min/max validation but there isn't an option to specific if you want a number or a string.

Solution?

Add a number type strictly for numbers only and keep the text type as stringifed text. Entering anything other than a number will remove that character and display a tooltip to let the user know only numbers are allowed.

Solaris9 avatar Aug 05 '22 03:08 Solaris9

@Solaris9 first of all thank u for ur investigation, that already implemented on package for react, and currently working on solid version then we will fix for svelte too so let s challenge the package with different cases to make it more better ;) https://www.formly-js.com

kamalkech avatar Aug 12 '22 00:08 kamalkech