PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

ZF2 Forms in Beta5

Note: This article was originally published at phly, boy, phly on 17 April 800.

Forms are a nightmare for web development. They break the concept of separation of concerns:

  • They have a display aspect (the actual HTML form)
  • They have a validation aspect
  • And the two mix, as you need to display validation error messages.

On top of that, the submitted data is often directly related to your domain models, causing more issues:

  • Not all elements will have a 1:1 mapping to the domain model -- buttons, CSRF protection, CAPTCHAs, etc. usually are application-level concerns, but not domain issues.
  • Names valid for your domain model may not be valid names for HTML entities.

Add to this that the validation logic may be re-usable outside of a forms context, and you've got a rather complex problem.