Project Idea: Form validation

chillu edited this page Apr 23, 2012 · 3 revisions

Project Idea: Form and Model Validation

Author: Ingo Schommer,

The form subsystem has always been central to SilverStripe, and has been used to do everything from simple signup forms to complex multipage workflows. While the view and data layer has been fairly battle tested, the validation layer doesn't allow much flexibility. Our goal is to improve form validation to work well in complex scenarios, both on server and in the browser, as well as bringing it closer to the model layer.

Previous brainstorming at


  • Move most validation from FormField->validate() to DataObject->validate()
  • Allow declaring constraints on the model (e.g. numeric fields, ranges, non-empty, callbacks)
  • Integrate model validation with specific form fields (binding?)
  • Consistently decouple the notion of a "required" (non-empty) field from the individual form field validation routines
  • Create more distinct data types to aid with validation (e.g. Email, IP)
  • Allow (optional) HTML5 attributes in form fields to trigger built-in browser validation
  • Expose validation metadata on the HTML of form fields to be used by various validation libraries
  • Dependent and conditional validators (PHP only)
  • Flexible generation of HTML validation errors (form + field specific), decouple from form field templates
  • Implement a proof of concept module using SilverStripe metadata to drive a JavaScript validation through a third party library
  • Write unit tests for all implemented functionality


  • Strong PHP skills and diligence to drive and implement a flexible form architecture
  • Ability to quickly grasp complex systems like the SilverStripe framework internals (good enough to change core components in a diligent fashion)
  • Intermediate frontend skills to set up and understand JavaScript validation libraries enough to customize them based on SilverStripe's output