Any way to remove a usefield with Composition Api? #3791
-
Im using <script setup> and Yup to make a form. I have a simple form that is used for Login or signup, when it is used as a signup I show a 3rd field for the Nickname. The problem is that when I hide it I still need to fulfill the rules like required, minimum, etc, it is also shown in handleSubmit. How could I make it dynamic? the destructuring for each useField confuses me a bit when trying. or Any way to remove it from the useForm? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
There isn't a way to do that at the moment since this isn't the recommended way to use I'm working on an enhancement for As a workaround you can experiment with conditional rules with |
Beta Was this translation helpful? Give feedback.
-
Can be a solution to use reactive schema as described in Reactive Form Schema example? |
Beta Was this translation helpful? Give feedback.
There isn't a way to do that at the moment since this isn't the recommended way to use
useField
. It is meant to be used as part of a component that is your custom input.I'm working on an enhancement for
4.6
where you can generate form models directly and avoid callinguseField
if you plan to use it in that way.As a workaround you can experiment with conditional rules with
.when
on Yup API