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
I have a big schema and has splitted the form in parts for easier fill in/overview. That means that I cannot use validateForm, but instead validate each field.
This works well if I step through it in the debugger, but when run normally, validateField returns true whatever the reality is.
Am I missing some logic here? Why is the throttle there? Is my approach unique and wrong?
From the package code:
// Throttle field validation to occur at most every 300ms,
// with leading and trailing calls.
export const validateField = throttle(_validateField, 300)
The text was updated successfully, but these errors were encountered:
The throttle code is necessary, since validation triggers reactivity a lot, especially if you have many reactive fields. We could, however introduce an API, where you set a different throttling speed or disable throttle at all, if that would help you.
If you use simple schema, you could also do manual validation this way:
const{ insertDoc }=AutoForm.getFormValues(formId)constcontext=formSchema.newContext()// formSchema is the schema you use for this formcontext.validate(formDoc,options)// options is optional but can be useful, like clean optionsconsterrors=context.validationErrors()if(errors&&errors.length>0){errors.forEach(err=>AutoForm.addStickyValidationError(formId,err.key,err.type,err.value))return// form is invalid}// otherwise remove sticky validation errors and continue with insert doc
I have a big schema and has splitted the form in parts for easier fill in/overview. That means that I cannot use validateForm, but instead validate each field.
I do (basically) :
This works well if I step through it in the debugger, but when run normally, validateField returns true whatever the reality is.
Am I missing some logic here? Why is the throttle there? Is my approach unique and wrong?
From the package code:
The text was updated successfully, but these errors were encountered: