A start using Model Glue pt2 - still theory

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:

Take all ingredients and throw it into a model glue app and let it boil for a couple of hours and vola. Well maybe not that easy. But before we continute, here is some thinking behind my thinking:

  1. The landing page is the form. Why? Its a one page app :o)
  2. The "successful" page breaks my rule for the 1 page app, but its nice to let the user know that something has happened to their data instead of just refreshing onto the same form.
  3. After a bit of decission making I am going to make my CFC's simple. No DAO's, Gateways, Business objects and Managers. Mainly because I'm/you are here to learn MG and its structure rather thant the best CFC coding practices.
  4. I'm not showing any styling/css in the demo. I might add it, but im sure all of you know how to replicate anything i'll do in HTML and css.

To the right you'll see our directory structure. To create this you have two options:

  1. Create the files yourself using the image as a guide
  2. For the lazy ones download the .zip file with the structure contained.

To end this next part, im going to give you the code for the dsp.frm.details.cfm, layout.main.cfm and dsp.successful.cfm.

The Form > dsp.frm.details.cfm

I'm going to make this simple, name, email and date of birth fields only. I'm covering <input> fields and <select> which i think will be enough scope to get the idea of how submittingforms in MG works.

<form action="" method="post">
<label for="name">Name</label>
   <input type="text" name="name" id="name" value=""/>
   <label for="email">Email</label>
   <input type="text" name="email" id="email" value=""/>
   <label for="dob">D.O.B dd/mm/yy</label>
   <input type="text" name="dob_day" id="dob_day" size="5" value=""/>/
   <input type="text" name="dob_month" id="dob_month" size="5" value=""/>/
   <input type="text" name="dob_year" id="dob_year" size="5" value=""/>

Successful page > dsp.successful.cfm

Not much thinking going behind this page.
<h1>WooHoo! the data has passed the validation rules and succeeded</h1>

Successful page > layout.main.cfm

There's no CFM in here yet so not much to tell you about, but im sure you will get the gist of it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><html xmlns="">
<InvalidTag http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>My MG App</title>
<h1>My MG App</h1>
<!--- Our content will go here --->