Changes between Version 7 and Version 8 of QuickStart/3:BuildingaForm

Show
Ignore:
Timestamp:
12/21/09 20:49:46 (16 years ago)
Author:
cfgrok (IP: 64.30.223.5)
Comment:

Updates to Quickstart Section

Legend:

Unmodified
Added
Removed
Modified
  • QuickStart/3:BuildingaForm

    v7 v8  
    1111 
    1212{{{ 
    13 <cfset submit = event.linkTo( event.getValue("xe.translate") ) /> 
     13<cfset submit = event.linkTo( event.getValue("xe_translate") ) /> 
    1414 
    1515<cfform action="#submit#"> 
     
    1919}}} 
    2020 
    21 Ok - what's with this "event" stuff? 
     21OK - what's with this "event" stuff? 
    2222 
    23 Whenever you're writing a .CFM view, there are two variables always available: "event" and "viewcollection." We'll get to viewcollection in a bit, but here's the rundown on event: 
    24  Event:: 
    25   An event object contains all the variables FORM and URL scopes as well as any other values added by the framework. 
     23Whenever you're writing a .CFM view, there are two variables always available: "event" and "viewcollection". We'll get to viewcollection in a bit, but here's the rundown on event: 
     24 
     25Event: 
     26  An event object contains all the variables in the FORM and URL scopes as well as any other values added by the framework. 
     27 
    2628The event object contains data like a query from a database or (big surprise) the translated version of the phrase that we're asking the user to enter. 
    2729 
     
    3537  * "eventValue" is the name of the URL variable that contains the current event. Don't worry about this one much, either. 
    3638 
    37 Therefore, the first line in that frmPhrase.cfm says "make me a link please, and use the value in the event object for 'xe.translate' as the name of the event." 
     39Therefore, the first line in that frmPhrase.cfm says "make me a link please, and use the value in the event object for 'xe_translate' as the name of the event." 
    3840 
    39 So what's with this "xe.translate" value? "XE" stands for "eXit Event," and has emerged as a best practice in Model-Glue applications (because it's taken from a best practice in Fusebox!). It lets us reuse this view in multiple places because we determine the action page of the form at runtime, instead of hard coding it into our .CFM template. 
     41So what's with this "xe_translate" value? "XE" stands for "eXit Event," and has emerged as a best practice in Model-Glue applications (because it's taken from a best practice in Fusebox!). It lets us reuse this view in multiple places because we determine the action page of the form at runtime, instead of hard coding it into our .CFM template. 
    4042 
    41 So where does the value of xe.translate come from? It's time to learn a bit of Model-Glue XML. (Don't worry! I just wrote the entire tag reference, and it's only sixteen tags! And about five of them are just placeholders that contain other tags!) 
     43So where does the value of xe_translate come from? It's time to learn a bit of Model-Glue XML. (Don't worry! I just wrote the entire tag reference, and it's only sixteen tags! And about five of them are just placeholders that contain other tags!) 
    4244 
    4345To create the actual event handler to display the form, do the following: 
     
    7072}}} 
    7173 
    72 Now, we need to provide the value for "xe.translate." We do this with the (very aptly named!) <value> tag: 
     74Now, we need to provide the value for "xe_translate." We do this with the (very aptly named!) <value> tag: 
    7375 
    7476{{{ 
     
    7779        <views> 
    7880            <include name="body" template="frmPhrase.cfm"> 
    79                 <value name="xe.translate" value="translationFormAction" /> 
     81                <value name="xe_translate" value="translationFormAction" /> 
    8082            </include> 
    8183        </views> 
     
    8688}}} 
    8789 
    88 Finally, run the page by visiting http://localhost/translator/index.cfm?event=translationForm . You should see your form. Viewing its source, you'll see that its action page is index.cfm?event=translationFormAction. 
     90Finally, run the page by visiting http://localhost/translator/index.cfm?event=translationForm. You should see your form. Viewing its source, you'll see that its action page is index.cfm?event=translationFormAction. 
    8991 
    9092You've just learned about a quarter of the Model-Glue framework. Not too bad, eh? 
     93 
    9194---- 
    9295 
    93 Back [wiki:QuickStart/2:ModellingourApplication#Quickstart2:ModelingourApplication Quickstart 2: Modeling our Application] 
     96Back [wiki:QuickStart/2:ModellingourApplication Quickstart 2: Modeling our Application] 
    9497 
    95 Next [wiki:QuickStart/4:HandlingaForm#Quickstart4:HandlingaForm Quickstart 4: Handling a Form] 
     98Next [wiki:QuickStart/4:HandlingaForm Quickstart 4: Handling a Form] 
    9699