DDAU with form component


#1

Im about to write a form component using DDAU pattern.

The idea:

  • the form component should have different states (valid, invalid, saving), based on the record, bound to it.
  • the form component yields some control-group
  • a control-group’s role: show/ hide validation error, gives unified look to the form (think of bootstrap markup)

I have got this so far : http://jsbin.com/votokuleqo/8/edit?html,js,output

The problem:

validation. Let’s say the model is validated, and model.name is empty, so the whole model is inValid. How should it be done using the DDAU pattern?

The control should send up a sign every time if its value changes, and the form should set the invalid form control group’s error property to true? How would the form identify the invalid property’s control group ?

As I saw in some form addon, it is done with bindings. But how should it work with DDAU?

EDIT

Here is an updated version: http://jsbin.com/rifiqokoke/1/edit?html,js,output

It works, but I need some code review. The most important issue: it uses observe, and binding. Is it the best way to do it?