I just voted for my the bugs I'd like see fixed in for the next version of flex. If you haven’t done so you can learn more about it here. One of the bugs I did not vote for was the ability to have a data provider ( although that’s not what I’ve been calling it) for a form. Not because I think it’s a bad idea, but only because I already have a component that will do this very thing. So I threw together this app with an implementation that you’re welcome to download and use. Before I get into specifics, though, I’d like to say that I don’t think the concept of a dataProvider is appropriate, even though, apparently that’s what it’s being referred to in the bug and on flexcoders. I think what the form really needs is ability to set all the controls in it on the one side, and get all the values off the form on the other side.
Anyways, the idea behind this is simple. I implemented an interface called IFormControl that allows me easily set controls. For every form you want to include in a form you can implement the interface. I’ve implemented simple controls in my demo, and the demo is actually a very scaled down version of what I actually use. But if you want to know where you can go with it, think about what it would take to place a data grid in a form control and pull off the appropriate values. Also, think about how you would use remoting to submit the form to your server, return either a Great Success or a Great Failure.
You can view my form control demo here.
If you have any questions, feel free to email, post comments or nothing.
brian..
I forgot to add that to get everything working together I have the simple rule that you name your control the name of the property you want it to have. Notice there's no binding as well.
Posted by: Brian Holmes | February 05, 2008 at 12:59 AM
WHATEVER.
The word is WHATEVER.
Even if your intention was to be ironic/satirical/trendy/WHATEVER a topic like that just makes you look like a halfwit and discourages me (and probably most other people) from reading the actual post as it is likely it is also written in irritating teenage-speak.
Posted by: Ark | February 05, 2008 at 09:04 AM
@Ark, no need to be feisty.
Posted by: Brian Holmes | February 05, 2008 at 09:13 AM
@Ark: LOL, you've obviously never read Jesse Warden's blog...
I think the use of whateva here is akin to "etc." And dude, it's his blog, he can talk however he likes, sheesh. :)
@Brian: Yeah, I've encountered a few bugs like that on the list: things that you could very easily make workarounds for, but it would be nice if you didn't have to. There's a certain undefined line where customization becomes 'hackiness', and it's at that point that the SDk should be improved. Voted for that one too, btw: dataproviders for a Form would be cool, even though you could create a mediator to do the job just as well.
Posted by: Joeflash | February 05, 2008 at 11:42 PM
@Joeflash, I hear what you're saying about the hackiness / improvement thing and I totally agree. I think the issue is being able to set and get the data off a form easily and I was just trying to show one way I've been doing it. dataProvider is just a semantic. I could easily have called my set form method dataProvider. In most of my use cases the data can come from several different sources, grids, lists, tree etc. And semantically, to me at least, dataProvider insinuates there's only one source of data. My example was a simple form, but where what happens when you have hierarchal data. There's too many possibilities for the flex guys to accommodate for, at least at this point. I didn't mean I didn't vote for the bug because I didn't like the idea, I do like the idea and actually my demo was based off an implementation I built over a year ago. Thanks for the comment! I enjoy having these discussions in the hopes it'll make me better at my craft. I'm going to be posting more complex data forms soon, and my value object post was intended to help me segway into showing how you can get and set very complex data from multiple sources.
Posted by: Brian Holmes | February 06, 2008 at 12:42 AM