RFC Forms

Work in Progress

The Problem

Consistency in form generation, validation.

I have a common pattern whereby I handle many forms for different aspects of an application where the HTML/RSP representation resides in many different files, fields are for the most part hand-coded and validation logic is specified elsewhere. This introduces some maintainence/revision challenges:

If I switch to a different CSS framework, I have to change the HTML layout on every page

If I change the data structure, I have to update the HTML/RSP code for every form that corresponds to that change in addition to changing the validation logic

Even where forms/validation specs are kept in a well-organised file structure, this introduces many points of failure as both the above scenarios require meticulous manual revision.

The Proposition

I’d like to create a form handler that takes one specification per form that can be used to both present forms in many UI environments and validate form submissions.

The specification would contain enough layout hints to pleasingly render in multiple front-end environments, whether that be Bootstrap (HTML), jQuery Mobile (HTML) or VID (Red or Rebol) requiring that only one template is necessary for each field type for a given environment.

The specification would also contain enough validation hints that would provide the above front-end environments with associated constraints, and where those constraints are insufficient, validation upon submission. Where a submission fails validation, the handler would offer hints toward resolving invalid fields.