Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove error #22

Closed
sytolk opened this issue Dec 20, 2013 · 5 comments
Closed

Remove error #22

sytolk opened this issue Dec 20, 2013 · 5 comments
Assignees

Comments

@sytolk
Copy link

sytolk commented Dec 20, 2013

If validation is complete and onValidationFailed function is executed:
((EditText) failedView).setError(message); -EditText field is in red Error.

Next user change this field and click on Submit button. Field map is re-validated and value of this field is valid (error appear on next field) but the old error in EditText exist too.
2 error fields is in red (first is valid but the error is not removed)

Can you add public method to get private Map<String, Object> mProperties;

and I can in mProperties loop to set on all field for validation:
textView.setError(null);

@ghost ghost assigned ragunathjawahar Dec 21, 2013
@ragunathjawahar
Copy link
Owner

@sytolk this is a problem with Android and not a Saripaar behavior. Since you can get all the EditText references, you could loop through them inside the OnClickListener before calling mValidator.validate().

@sytolk
Copy link
Author

sytolk commented Dec 21, 2013

I know but its better to use function before validate like:
removeErrors();
mValidator.validate();

void removeErrors(){
Map<String, Object> mProperties = mValidator.getMProperties();
for(Object edit :mProperties.values()){
(EditText ) edit.setError(null);
}
}

the problem is that I don`t have mValidator.getMProperties(); public method

@ragunathjawahar
Copy link
Owner

mProperties allows users to put in custom properties that they'd like to use with the validator. It doesn't not contain references to views. Besides,

  1. The problem that you are noticing is platform specific on Android. It doesn't happen on all Android versions. So, it would be better to use the workaround that you've come up with instead of doing that from within the library.
  2. The error messages need not be set using the EditText.setError() method. Developers could be showing error messages using a Toast, the Crouton library or via a plain TextView, therefore the library could not figure out the means that was used to display the error message.

@ragunathjawahar
Copy link
Owner

@sytolk, a similar issue was reported last year. Using a TextWatcher as a workaround might help. Please check issue #5

@sytolk
Copy link
Author

sytolk commented Dec 26, 2013

Thanks but I don`t think that TextWatcher can help me. I use androidannotations @focuschange annotation on validation method.

The problem is that:
I have annotated variables @password @Email ...
I cant get list of all annotated variables from validation framework -> public method mValidator.getMProperties() is missing.. why ?
I need to:

  1. to annotate variables
  2. to hold list of annotated variables -> this list is written in validation framework too (mProperties)
  3. to add some Watcher to setError(null) or something else

can I skip step 2 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants