You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use fields.number(), it validates even if the field is not a number.
importforms,{fields,validators}from'forms';constnestedForm=forms.create({age: fields.number({required: validators.required('age')}),});consthandlers={success(form){console.log('success');},other(form){console.log('fail');},};nestedForm.handle({age: 'this is a text'},handlers);// console prints "success"
The text was updated successfully, but these errors were encountered:
Thanks for the report! Currently, the field doesn't come with implicit validators - it has a "parse" method which converts its value to a number, but you're expected to add the digits or integer validator yourself. fields.number more dictates the input "type" attribute, than validation.
When I use
fields.number()
, it validates even if the field is not a number.The text was updated successfully, but these errors were encountered: