简体   繁体   English

如何对带有react-final-form的条件输入进行条件验证?

[英]How do I have conditional validation for conditional inputs with react-final-form?

I've set up some conditional fields as per https://github.com/final-form/react-final-form#conditional-fields 我已经按照https://github.com/final-form/react-final-form#conditional-fields设置了一些条件字段

The form is complex and uses components that are used elsewhere. 表单很复杂,并使用了其他地方使用的组件。 These components have validators built in so they are consistent across the application. 这些组件具有内置的验证器,因此在整个应用程序中保持一致。 If the fields get hidden but they have a validator, the form cannot be submitted. 如果这些字段被隐藏但具有验证器,则无法提交表单。

How can I get around this? 我该如何解决?

Fair comments folks, it must've been late in the evening when I posted this. 亲爱的评论人士,当我发布此消息时一定是在深夜。

MCVE example https://codesandbox.io/s/ymw0nvjy2j turns out to work fine, so must be something weird I've done in my app MCVE示例https://codesandbox.io/s/ymw0nvjy2j可以正常工作,所以一定是我在应用程序中做过的奇怪的事情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM