Open rifkyhaekal opened 1 year ago
Hello @rifkyhaekal! Apologies for a late reply!
I just checked the code you used and seems like it's missing the part where we actually update the field's value when input changes.
By design, the implementation should look something like this:
// ...
field(fieldClass = RegisterRequestDto::name) {
InputTextField(
labelValue = stringResource(id = R.string.text_name),
onTextChanged = {
setField(it)
registerViewModel.onTriggerEvent(RegisterEvent.NameChanged(it))
}
)
}
// ...
This will allow the form/field's state to be updated and validated.
You can check the details in the documentation here!
Hope that helps xD
I have my custom text field input, like below: `form(RegisterRequestDto::class) { Column( modifier = Modifier .fillMaxWidth() .constrainAs(contentColumn) { top.linkTo(parent.top) bottom.linkTo(button.top, margin = (200).dp) start.linkTo(parent.start) end.linkTo(parent.end) } ) { field(fieldClass = RegisterRequestDto::name) { InputTextField( labelValue = stringResource(id = R.string.text_name), onTextChanged = { registerViewModel.onTriggerEvent(RegisterEvent.NameChanged(it)) } ) } LargeSpacer() field(fieldClass = RegisterRequestDto::email) { InputTextField( labelValue = stringResource(id = R.string.text_email), onTextChanged = { registerViewModel.onTriggerEvent(RegisterEvent.EmailChanged(it)) } ) } LargeSpacer() field(fieldClass = RegisterRequestDto::password) { PasswordTextField( labelValue = stringResource(id = R.string.text_password), onTextChanged = { registerViewModel.onTriggerEvent(RegisterEvent.PasswordChanged(it)) } ) } LargeSpacer() field(fieldClass = RegisterRequestDto::confirmPassword) { PasswordTextField( labelValue = stringResource(id = R.string.text_confirm_password), onTextChanged = { registerViewModel.onTriggerEvent( RegisterEvent.ConfirmPasswordChanged( it ) ) } ) } }
Is i'm doing it correctly? Because the validation is not working