-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to handle dependent field props? #21
Comments
Are you talking about situations where you need to compare things like a If you're trying to do things like "Hide certain inputs when a certain drop down value is selected", I believe this is possible with an object schema at the moment but might not be a super smooth developer experience? Might be worth adding a more elegant way to deal with these situations... Let me know some more details on your use case |
I am talking about passing We have a use case where the user needs to pick three |
@christopherGdynia Ah okay thanks for the info - I would recommend using an object schema for this right now I think, or just writing plain old JSX for these more complex forms. For the future, I think there's an API that could simplify this though that could be added. We could add a feature where props can be calculated from form state by passing a function instead of an object: return (
<Form
props={(fieldValues)=>({
endDateSelect: {
minDate: fieldValues.startDate
}
})}
/>
) Would this suffice, I think it'd cover this use case pretty well? |
@iway1, maybe pass as second parameter the form state, with error state. |
@christopherGdynia good idea, we'll pass the error state as well. |
In some
forms
, field props are dependen on values from other fields.How are we going to solve this?
this could be quiet tricky
A solution for now is creating a custom component, which is dependent and loading the formState from the context (when implemented).
This should be documented. :D
The text was updated successfully, but these errors were encountered: