Many times, you’ll see this sort of situation when writing a form, where you need to load “extra” queries for things like state and country selectors:
<!--- `views/customers/new.cfm` ---> <cfparam name="customer"> <cfparam name="countries" type="query"> <cfparam name="states" type="query"> <cfoutput> #startFormTag(route="customer")# #textField(objectName="customer", property="name")# #textField(objectName="customer", property="email")# #select(objectName="customer", property="countryId", options=countries)# #select(objectName="customer", property="stateId", options=states)# #endFormTag()# </cfoutput>
There are many ways that you can load the data that this view template is requiring, each with their pros and cons. I’ll cover 3 different approaches.


