There are many ways this cat can be skinned. That said, we don’t specifically cater for non-formtools based forms in FarCry. You can use just about any technique that gives you a random block of HTML markup on a page.
(Note if you are working with forms in general, the FarCry
formtool engine is really very cool for this sort of thing, but I’ll leave that for another post)
I’m assuming this is a self-calling, HTML form using some ColdFusion code for form processing, and that it needs to be present in the standard navigation of the site.
Our least hated, favourite way of approaching random blocks of CFML is to use an
Include is a generic hook for including a block of code within a layout template, into the site tree. If you don’t need to be in the site tree then there are other approaches.
Create the form
First we need a view that we can call to show the form. For the sake of simplicity we’ll create a type webskin on the Web Page (aka
dmHTML) content type.
Create a file called
./webskin/dmhtml/displayTypeBodyMyform.cfm with a simple self-posting form:
<cfif NOT structIsEmpty(form)>
<h2>Hello cruel world!</h2>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname"><br>
<input type="submit" value="Submit">
Re-start your application to register the new webskin.
Add a hook to the site tree
Create a new menu item in the site tree, and select the
Include content type.
Fill in whatever metadata is appropriate. Select the Layout: Content Template that is most suitable — probably whatever the standard full page view for your theme is. Your
body webskin will be rendered within it.
The clever bit is selecting the Content Type View: Content Type as Web Page (aka
dmHTML), and then from the drop down of web skins choose the form you created earlier ie.
Publish the tree folder, and view.
(Note, do not use included objects. Included objects are deprecated. Included objects will fall in a well and die.)