0.0.15-beta.6 • Published 6 years ago
ember-form-validations v0.0.15-beta.6
Lego blocks
We need a form to have the following properties:
clientFormErrors: errors due to checks made before a form is submittedserverFormErrors: errors arising from the request that was madeclientFormErrorStatus: if errors exist withinclientFormErrorsserverFormErrorStatus: if errors exist withinserverFormErrors
Usage
- Each of
clientFormErrorsandserverFormErrorsrepresent key-value pairs of errors. They need to be initialized on the form component e.g
export default Component.extend(ValidatableFormMixin, {
clientFormErrors: EmberObject.create({
identification : null,
password : null
}),
serverFormErrors: EmberObject.create({
credentials: null
})
})- Within Canopy forms, we wanna satisfy the following
- all errors should show up together at the end of the form before the submit
- the erroneous fields need to be highlighted with a red cross
- focusing into an erroneous field should clear the error
- focusing out of a field should do the validation for whether the field deserves an error
- submit button needs to be disabled if any fields are erroneous
- a server error would mean cleaning out existing client errors
- focusing into a field after getting a server error should clear the server error
ValidatableFormMixin
The ValidatableFormMixin makes life easier when dealing with the requirements listed out above. The following are made available
- fn
currentFormErrorStatus(args:type, which can either beserverorclient). returnstrueorfalsedepending on whether relevant errors exist - fn
updateServerError(args:property,error) - since the server errors are passed on from a parent component, this can be used to update theserverFormErrorswith the relevant error, throughdidUpdateAttrsfor example - fn
updateClientError(args:property,error) - hook
afterServerErrorUpdate - hook
afterClientErrorUpdate - hook
afterClearingFieldError - hook
afterSettingFieldError - action
setFieldError(args:field) - action
clearFieldError(args:field)
0.0.15-beta.6
6 years ago
0.0.15-beta.5
6 years ago
0.0.15-beta.4
6 years ago
0.0.15-beta.3
6 years ago
0.0.15-beta.2
6 years ago
0.0.15-beta.1
6 years ago
0.0.15-beta.0
6 years ago
0.0.15-alpha.4
6 years ago
0.0.15-alpha.3
6 years ago
0.0.15-alpha.2
6 years ago
0.0.15-alpha.1
6 years ago
0.0.15-alpha.0
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago