-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Describe the bug
I am trying to add validate for some dependent validation in textField/string which is under listField and even outside, I noticed that validate function in not working. I saw same issue in your storybook too.
To Reproduce
Steps to reproduce the behavior:
Existing issue in storybook example:
- Go to 'storybook'
- Click on 'try to submit password & confirmPassword without match'
- Notice the error is not displayed
- Put console.log in validate in local, validate doesnt trigger
Issue in my schema(test):
- I am using below create function to create my formAtom object and binding to respective tsx
// fieldsAtom creator
// This function is used to have isolated scope
export const fieldsCreatorTierConditions = () => {
const unit = stringField({
value: Unit.QUANTITY,
preprocess(value) {
return value;
},
name: 'unit',
validate: ({ get, event, value }) => {
debugger;
console.info('UNIT:Validation: THIS IS NOT TRIGGERING');
},
});
const values = listField({
validate: ({ get, event, value }) => {
debugger;
console.info('ListField:VALIDATION, this is not triggering where as listAtom works but not on Onchange of any fields in listAtom');
console.info('list Validate:', value);
return ['what an error', 'yeah its fine'];
},
value: [
{ min: '', max: '' },
{ min: '', max: '' },
{ min: '', max: '' },
],
fields: ({ min = '', max = '' }) => ({
min: stringField({
name: 'min',
value: min,
schema: z.string().min(1),
validate: ({ get, event, value }) => {
debugger;
console.log('min:validation: this is also not working,/triggering');
},
}),
max: stringField({
name: 'max',
validate: ({ get, event, value }) => {
debugger;
console.log('max:validation: this is also not working,/triggering');
},
value: max,
}),
}),
});
return { unit, values };
};- validate never fires with and without schema.
3
Expected behavior
In both the above examples, I would like to see validate does its work. If schema cannot exist when validate exist then it should be clearly mentioned. Even without schema, validate should first work. Please provide some example or provide help.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
I think we need to have enough complex examples to test / view in storybook