Skip to content

Commit

Permalink
Add documentation to main js file
Browse files Browse the repository at this point in the history
  • Loading branch information
denniscdmc committed Jun 3, 2024
1 parent 4aa0e92 commit 0853eb5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addon/components/form-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { isPresent } from '@ember/utils';
import { computed } from '@ember/object';
import Component from '@ember/component';

//
// A generic wrapper around a form element (input, select, radios)
//
// By providing this component with an attribute name on a model, this component will auto-detect any validation errors (from DS.Errors)
// on the specified attribute, and apply appropriate error classes and error messages to the field.
//
// This component also support custom errors that is not part of the model (client-side validations, for example).
// Although comprehensive client-side validation libraries are available, we do not currently need the full capability of those libraries and a simple custom error string will do.
//
// This component is a modified and simplified version of https://alexspeller.com/server-side-validations-with-ember-data-and-ds-errors/
//
export default Component.extend({
classNameBindings: [':form-group', 'hasError:has-error'],

Expand Down

0 comments on commit 0853eb5

Please sign in to comment.