ragunathjawahar / android-saripaar

UI form validation library for Android
Apache License 2.0
3.22k stars 460 forks source link

Validation not working second time in kotlin #204

Closed munnadroid closed 6 years ago

munnadroid commented 6 years ago

Hi, I am using kotlin, saripaar and butterknife. Suppose I have validation in submit button of FragmentA. When click in submit button its working fine. Then validation success, app goes to FragmentB. Then again come back to FragmentA through back button. Then validation not working.

rinav commented 6 years ago

Same situation happening in my app as well. In my case, the validation is happening inside a Dialog, built from Material Dialog lib Any guidance to solve the issue?

cecyurbina commented 6 years ago

I have the same problem, I am working with fragments using this library https://github.com/apl-devs/AppIntro, when come back to first fragment validation is always succeeded.

munnadroid commented 6 years ago

Not able to find the solution yet, I am planning to use https://github.com/inmite/android-validation-komensky library for validation.

Has anyone found the solution?

munnadroid commented 6 years ago

I solved the issue. I have all the saripaar initialization in basefragment like below:

if (validator == null) { validator = Validator(this) validator.setValidationListener(this) }

I removed the null check part and now its working fine.

validator = Validator(this) validator.setValidationListener(this)