when does not work with number
See original GitHub issueI get error: TypeError: Cannot read property 'length' of undefined
For example I have this validation:
const agreementDurationAmount = Yup.number().when('agreementDuration', (agreementDuration) => {
if(agreementDuration === 'Miesięczny') {
return Yup.number().min(1, 'Czas trwania umowy: wprowadź liczbę miesięcy');
}
if(agreementDuration === 'Tygodniowy') {
return Yup.number().min(1, 'Czas trwania umowy: wprowadź liczbę tygodni');
}
return Yup.number();
});
And such object:
{
agreementDuration: 'Nieokreślony',
agreementDurationAmount: 0,
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
[SOLVED] Keyboard numbers not working - Driver Easy
If the NumLock key is enabled and the number keys still don't work, you can try pressing the NumLock key for about 5...
Read more >Fix: Keyboard Not Typing Numbers in Windows 10 - Techbout
The most common reason for laptop keyboard not typing numbers is due to the Num Lock key being accidentally disabled. Depending on the...
Read more >What to Do If Keyboard Number Keys Are Not Working on ...
How to Fix Number Keys Not Working Windows 10/11 · Fix 1: Turn off Mouse Key · Enable the NumLock Key · Update...
Read more >Top 8 Ways to Fix Number Pad Not Working on Keyboard in ...
Top 8 Ways to Fix Number Pad Not Working on Keyboard in Windows 11 · 1. Enable Num Lock on Keyboard · 2....
Read more >Keyboard Not Typing Numbers - Why And How To Fix It
How to Fix Keyboard Not Typing Numbers · Turn Off Mouse Keys · Check for Stuck Shift and Alt Keys · Turn Off...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If anyones reading this. If you use
when
in a schema the field it depends on should also be in the schema. So @wieseljonas would need to declare a type and rules formainType
in the same schema aslandSurface
.Works, I just needed to add:
agreementPenaltyEnable: yup.boolean(),
Like this: