When creating sub-form components I find that a common case is composing 
several form fields into a single object which is bound as a parameter back to 
the parent.

For example a date component used on several forms that has drop downs for day 
& month, and a text box for year. The parameter bound to the parent page is 
simply a date (a Date object or a String form - doesn't matter) which is 
composed from the three separate form elements. The only way I know of to 
support this is to used the setter for the last form element's property to set 
the bound parameter with the composed object. (this is the technique used in 
the T5 book)

This works okay, but I've never been very happy with it and recently it meant 
that I had to copy a component class to extend it because of using this 
technique. This is because the properties are private (T5 requires this) and 
the setter for one has a side effect that causes problems. This got me to 
thinking (again) if there was an alternative technique for achieving this, and 
if there wasn't then how could it potentially be done.

So, does anyone currently have a better way than the one I've described?

I was thinking that this could potentially be achieved by another component 
event as part of the form submission. Each component within the form (not just 
the parent of the form) would need an event firing after the properties have 
all been set from the submission, and before validation, where they could 
update bound parameters with composed objects from the form properties. Is this 
at all possible to achieve?

Thanks,

Andy.

Reply via email to