First Name Username Email
[/html] This basic form would be the basis for how the front end would
work. Based on the metadata we're marking up on the form (namely those
"validate” attributes). The idea is that a form has basic validation
rules associated with it — when to validate it and where to put the
return values. Each field in the form would then inherit the validation
rules defined in the form, but could also overwrite them. For instance,
this form would validate everything on submit by default, and place and
error messages "before” the field they're for. Other options might
include "after”, "top” or "bottom” for the very top of the form, or
"above” and "below” for errors to be put at the top of the current
grouping. The HTML will require some kind of hooks for where to place
these messages of course, which is where some the convention markup
comes into place. The before/after messages would look for the
formid-fieldid-field element and place it in an element before that.
Top/Bottom would look for the formid and place based on that, and the
grouping option would look for an element with the class of group that's
a parent element. Now how would this know where to submit to for
validation? That's another easy convention to handle. Let say there's
three possible things that can be validated via ajax on a form- - an
entire form, a single object from a form or a single field from a form.
Creating URLs for these to submit to might end up with something like
(validate.field?object=objName&field=fieldName) Using Coldcourse you
discover the validation URL to use based on the form field names. The
fields are named in the form object[field] which is a Ruby on
Rails/ColdFusion on Wheels convention. On the server side these are
converted to structures before we ever have to start working with them.
This validate controller would then call up some sort of
ValidationService where the real meat of the work happens. The
controller then knows to return the errors it gets back to the
is just brainstorming at this point, but looks easy enough to implement.
If there's anything I'm overlooking, or any suggestions with this so far
feel free to comment. Tomorrow: start planning the service layer!