On 22/01/2005, at 6:07 PM, dave buhler wrote:

1) Should the views be nothing more than the forms? Where does the
validation go?

Hi Dave,

So far what I've done for validators, filters, formatters and other "business helper" classes is make sure they stay pure business logic e.g. working with arrays or single VOs, and add them to my business package - they're business logic I want to reuse, so it seems to be a good place for them. I then instantiate them on in my view and use them directly, e.g:

<business:ContactFilter id="contactFilter"/>


<mx:Form>
<mx:FormItem label="Filter">
<mx:TextInput id="criteriatxt"/>
</mx:FormItem>
</mx:Form>

<mx:DataGrid id="grid" dataProvider="{contactFilter.filter(contactList, criteriatxt.text)}"...

It doesn't hurt the reuse prospects of the view or the business helper doing this - the business helper is more permanent than the view, and the business helper is oblivious to where it's being used. My rule of thumb is that if it doesn't affect the model and it can't affect other parts of the UI then it doesn't necessarily have to go up through a command.

As for shared variables, so far our global scope has been the application, we keep the central VOs there and bind them down through public properties to any view that needs to reference them. Not sure if that was your problem.

Hope that helps.

Robin
http://www.rocketboots.com.au

Reply via email to