Form and model validation stories
Clone this wiki locally
Proposed success criteria - DRAFT. Pulled out from the project proposal and mailing list.
As a developer:
- I can add validation to the model, so the DB data always conforms to business rules.
- I can apply validation to the form, so I can feed the information on wrong input back to the user.
- I can opt for the form to use a default validation based on model and field constraints.
- I can configure basic validation via static config options.
- I can inject the validation rules during the runtime, so I can build more complex validation schemes.
- I have access to the library of predefined validation rules (e.g. for email, date, phone)
- I can reuse the validation rules between form, model and fields
- I can apply a required-field rule in a way that still allows me to add other rules that apply if the value is present.
- I can create custom validation rules.
- I can fail the form validation either globally or specifically to some fields.
- I can validate one field against another (e.g. password field against confirm-password, checkbox against a textfield)
- I can apply multiple errors to a field, so I can provide complete information to the user (e.g. the password is too short + the password does not contain any numbers.
As a frontend developer:
- I can easily customise error messages on rules, while reusing the original parameters (such as value and field name), so it's easy to do a simple wording change without the need to blackmail a backend developer.
- I get the HTML5 validation as the default when the form is generated
- I get enough metadata about the constraints that I can build my own generic JS validators
- I have enough documentation for these constraints so I can implement the JS validators without reading the PHP code
- I can validate specific fields via AJAX, so I can provide instant feedback to the users
- I can do the complete form validation via AJAX, so I can pre-validate it without submitting it
- I obtain the errors within the markup as spans (and I don't need any other error metadata)
- I get classes on input fields that are required and that are errorneous for basic CSS styling