-
Notifications
You must be signed in to change notification settings - Fork 52
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
Display validation errors under each field. #13
Display validation errors under each field. #13
Conversation
The new method display the validation string under the field.
Nice, that's a useful feature! Thanks for the pull request. I'll review the code and let you know if I have any comments. |
* You MUST set the {@link ValidationErrorDisplayMethod#context} and {@link ValidationErrorDisplayMethod#controller} | ||
* before calling showErrors. | ||
*/ | ||
public enum ValidationErrorDisplayMethod { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of an enum, I believe it would be better to use an interface and provide different implementations. That way, an app can easily extend NexusDialog to support other display methods. An enum is not extensible without modifying NexusDialog itself.
setError(null) on a field will now delete the error message. ValidationErrorDisplay is no longer an enum but is now an Interface, with one method: showErrors(List<ValidationError>).
This commit gives the full command of the error display to the user. He will have to manually call `FormController.showValidationErrors()` and `FormController.resetValidationErrors()`
I thought afterward of the extension problem for the enum, an interface would indeed be nice. About that: |
Display validation errors under each field.
…box-wrapping Feature/fix checkbox wrapping
I added a new way of displaying the validation error string which print the error under the field instead of displaying everything in a popup. The result look like that:
This new method is selected by default, but the popup can still be selected from the Activity using the line:
getFormController().setValidationErrorsDisplayMethod(ValidationErrorDisplayMethod.GENERAL);
What do you thing about it?