bisq2 icon indicating copy to clipboard operation
bisq2 copied to clipboard

Improve input validation

Open HenrikJannsen opened this issue 1 year ago • 6 comments

We should show a error message below the text input component. I guess the help field of the MaterialTextField would be the right place and style (just need to be in red). The help field is rarely used, but if its used we might prefer to not show both in case of invalid input but toggle the visibility of help and error field instead.

I think a popup is not needed as it creates to much attention IMO.

We call the validation at focus out but that concept needs to be reconsidered as if the user has invalid input and not moving the focus out of the input field they will not get the feedback if the invalid input. One option would be to add a delay of about 2 sec. after last input activity to call the invalidate method additional to the focus out.

To call validate at each input might be annoying as while entering a valid value there might be intermediary invalid inputs (e.g. if min value is 100 and user enter 2 -> 20 -> 200 they would get at first 2 inputs a error message.

HenrikJannsen avatar Sep 03 '23 04:09 HenrikJannsen

@namloan Would you be available for that issue?

HenrikJannsen avatar Sep 03 '23 04:09 HenrikJannsen

Agreed on Matrix to do the following:

  • Let "next" buttons be enabled and call validate on click. if invalid input show error msg at invalid input component. if there is none (like payment method chip buttons) show a popup (e.g. you need to select at least 1 payment method).
  • On focus out call validate.
  • No delayed validation if user leaves focus in field. when he clicks next he gets the error.

namloan avatar Sep 16 '23 08:09 namloan

Related to https://github.com/bisq-network/bisq2/issues/1152

HenrikJannsen avatar Nov 07 '23 10:11 HenrikJannsen

@namloan Are you still working on that?

HenrikJannsen avatar Jul 16 '24 10:07 HenrikJannsen

nope, free for anyone to take. However does this still make sense? we may need to review the places where we're still missing validations or whether we'd like the current ones to behave differently.

namloan avatar Jul 27 '24 12:07 namloan

@namloan @HenrikJannsen What would you guys say is the status on this one? can I help? The PR referred as related (https://github.com/bisq-network/bisq2/pull/1152) has been dropped

rodvar avatar Jul 29 '24 06:07 rodvar

There are some deprecated Validator classes still around. Those should be replaced. I think the rest can be done on demand when we see a validation is missing.

HenrikJannsen avatar Aug 01 '24 04:08 HenrikJannsen

@rodvar I took the issue myself...

HenrikJannsen avatar Aug 18 '24 13:08 HenrikJannsen