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

Add validation error messaging in Bootstrap and Foundation components #153

Closed
udos86 opened this issue Oct 23, 2016 · 4 comments
Closed

Comments

@udos86
Copy link
Owner

udos86 commented Oct 23, 2016

Will arrive in 1.1.0

@udos86
Copy link
Owner Author

udos86 commented Oct 23, 2016

@DavyJohnes: Please have look at 94ee42b.

@DavyJohnes
Copy link
Contributor

DavyJohnes commented Oct 24, 2016

@udos86 I think we need to find a way to define error messages mapping once for the whole form and add ability to override it for particular controls in model. I believe in most scenarios messages patterns will be the same for each control across all forms. Current implementation forces to define error messages for each control, I think it is redundant.
May be it is necessary to introduce new form model class which will cover all these things? Something like that:

class FormModel {
    public options: FormOptions;
    public controls: Array<DynamicFormControlModel>;
}

class FormOptions {
    public errorMessages;
    // ... other form-global options.
}

@DavyJohnes
Copy link
Contributor

Added one more comment here: 94ee42b
Everything else looks good, thanks for your work!

@udos86
Copy link
Owner Author

udos86 commented Oct 24, 2016

@DavyJohnes Thanks for the great contribution! I'd like to avoid reintroducing a DynamicFormModel class as this would make the library more complex to use.

And I strongly believe, error messages should be set for single DynamicFormValueControlModels. This ensures that error messaging is only enabled when the errorMessages object is explicitly set on the model. It provides more freedom of choice as it allows individual messages for every control and the message templates are also included in the JSON serialization. Applying it to the entire form, however, would be just an assumption.

As a developer, having to manually override a framework's wrong assumption in order to generate individual messages for a single control is not ideal from an architectural point of view.

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

No branches or pull requests

2 participants