Model Glue Bean, and multi page form demo app
I've bean(bad pun I know) playing around with makeEventBean in Model Glue.
I was going to do a write up about it, but decided that that took up too much time as it also covered a multi-page form.
I've bean(bad pun I know) playing around with makeEventBean in Model Glue.
I was going to do a write up about it, but decided that that took up too much time as it also covered a multi-page form.
There was a post on the MG lists about setting up Model Glue and the fact you need mappings. I had this lying around from some internal writings and thought it might be useful. It details setting up MG with no mappings.
I've been working on a app with a couple of forms and wanted to break the validation rules into different group of rules e.g.
1. Rules for address
2. Rules for personal information
3. Rules specific per form.
What this allows me to do is is per validation call in the controller just use the validators i need.
How I am doing it:
1. Create a controller called validator.cfc
2. Create you validation.cfc's i.e.
Your validation cfc's should look like this:
This has just came up on the MG Lists and I thought i should post my solution on how I implement a UDF file in MG
1)My UDF file is a component (cfc) on the root of the site.
Example UDF:
2)Then in my controller (in the onRequestStart):
3)On my view page I have
Then to call a function
If you use Eclipse and are creating a lot of Model Glue project check out Wayne Grahams ANT script. Not only does it help you create a MG project quickly, but if like me you don't know ANT all too well its a good guide to creating your own build.xml files.
More of a reminder to myself. But when adding text to .xml files (in my case the beans.xml) don't forget to Ascii escape characters like £(£).
You can find a pretty comprehensive Ascii list here http://www.lookuptables.com/
Unlike Fusebox there is not a global init variable setting file With MG. If you do need to set up some global vars the way i'm doing this (and seems to be the norm nearly) is:
Below is a quick run down of the config.xml setting in Model Glue, though i would like to take credit :o) i got this from the MG lists, posted by Doug Hughes
Here's a rundown of the settings:
So you've decided that you can handle building this huge app comprising of 1 page and want to carry on. Well its time to throw in a little more theory first. Sorry.
We've seen the flow and now need to think of the structure. Simple. We need:
After a couple of false starts i'm finally getting my head down and into Model Glue(MG) - you know, the framework that a few people have mentioned on their blogs :o). Why now? is it to jump on a band wagon? Is it because ver 1.0 has now gone stable? Sorry no, its because i want to learn it, and have a small (very small) app to do, and where better to start?
Sitting in the hotel room last night i finally started getting into Model-Glue - Something i've been meaning to do for ages. Using Cfeclipse i got through half the quickstart guide when i got side tracked thinking that the XML file should have a DTD file for validation - something else i've been wanting to get into for ages since noticing the minor glitches in the FB ones.
So after some digging around the web i ended up creating the following file: modelglue.dtd
If you currently dont have a XML editor for Eclipse - i'm currently using XML Buddy which has been working well.