Is there anything more sweet than write a long post and see it vanish in the 
air?
Perhaps Chrome plus Flexcoders' "Rich-Text Editor (Beta)" is asking too much :)

I'll try again, shorter version.

> Another approach, if you're set on binding: Rather than the "outer"
> component waiting for creationComplete on the inner component to set the
> model value, simply put code in the inner component that waits for
> creationcomplete and creates the component->model "return" bindings
> programmatically via BindingUtils.

Hi Josh.
I didn't give up on bidirectional binding, but I admit to be close to the metal 
:)
The strategy that seems to work is this:
- a value object with two methods: saveOriginal and restoreOriginal, also 
useful to manage the form's cancel button
- binding through BindingUtils into createComplete
- a mono-binding for date fields, because of a bug in DateField.as

Here is some code. In case of interest, I'll post the implementation.
bindForCreate does a single bind, while bindForUpdate does two.

Enri

// a form
  [Bindable]
  public var vo:SomeVO;
  
  [Bindable]
  private var voOut:SomeVO;
  
  private var cws:Array = []; // used later to unbind
  
  private function creationComplete():void {
    if (vo.isNew) {
      extend(cws, bindForCreate(vo, 'date', datefield, 'selectedDate'));
      extend(cws, bindForCreate(vo, 'name', nameField, 'text'));
    } else {
      voOut = new SomeVO();
      vo.saveOriginal();
      extend(cws, bindForUpdateException(vo, voOut, 'date', datefield, 
'selectedDate'));
      extend(cws, bindForUpdate(vo, 'name', nameField, 'text'));
      vo.restoreOriginal();
    }
  }

Reply via email to