Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Question regarding Complex validation based on state of the model #18

Open
farshid1 opened this issue Nov 17, 2017 · 0 comments
Open

Question regarding Complex validation based on state of the model #18

farshid1 opened this issue Nov 17, 2017 · 0 comments

Comments

@farshid1
Copy link

farshid1 commented Nov 17, 2017

Hi there,

The library is amazing and has taught me great deal of information. I am very new to react and I have come across a challenging validation problem. My validation is dependent on the state of the model. For example if a specific select option is selected a text field will appear and that's when the text field becomes required.

I'm still trying to get my head around HOCs so it's not very clear if they are indeed useful in my case (I have a strong feeling they are). Particularly I wanna be able to dynamically place different input elements on the form depending on the current state of the model (show/hide elements). This requires me to be able to remove and add properties to my model (which the reformed HOC does).

What happens in cases where validation must be applied on submit as oppose to synchronous validation. How can HOC solve such problems? I've been looking into the source code for a few hours and I mostly understand what's happening and the solution is great for simple forms. When complexities like dynamic field rendering and validation, I'm not sure how you can abstract these logics with the use of HOC. Any insight would be greatly appreciated.

@farshid1 farshid1 changed the title Complex validation based on state of the model Question regarding Complex validation based on state of the model Apr 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant