Skip to content

Integrating Form Validation #53

Answered by arkivanov
manosbatsis asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question!

  1. Indeed, both libraries seem to overlap with MVIKotlin, they both hold and update the state. Moreover, form-builder is tightly coupled with Jetpack Compose. I don't see any reasonable way of using those libraries together with MVIKotlin.
  2. The Store holds the state and manages its changes consistently. You can just have all fields in the state class, and either validate values while they are being changed, or later on submission.

Here is a possible State class:

data class Field<T>(val value: T, val isError: Boolean)

data class State(
    val email: Field<String>,
    val phoneNumber: Field<String>,
)

In order to keep the Store as simple possible, the validation lo…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@arkivanov
Comment options

@manosbatsis
Comment options

Answer selected by arkivanov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants